Guest User

Untitled

a guest
Jan 25th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. json and gist
  2. // if the following fails for you, please check if you have to update wslib's curl method by the one in
  3. // json/extString-curl.scd
  4.  
  5.  
  6. q = ();
  7.  
  8. // set your username / password here if you wanna create personalized gists, but its optional.
  9. q.username = nil;
  10. q.password = nil;
  11.  
  12.  
  13. ////////////////////////////// get existing gists /////////////
  14.  
  15.  
  16. q.list = Gist.allGistsFor("LFSaw", q.username, q.password);
  17. q.list.first.id
  18.  
  19.  
  20. // the gist dict for the latest gist of the user "LFSaw"
  21. q.gist = Gist.getGist(q.list.first.id)
  22. q.gist.files.asArray.first.content
  23.  
  24.  
  25. // the gist dict for an example gist for the OpenSynthDef world
  26. q.gist = Gist.getGist(1109924)
  27. q.gist.files.asArray.first.content.postln.interpret.play
  28.  
  29. ////////////////////////////// post new gists /////////////
  30.  
  31. ( // test
  32. var content = (
  33. 'SynthDef.sc': "SynthDef(\out, {Out.ar(0, FSinOsc.ar(247))})",
  34. 'SynthDef2.sc': "SynthDef(\out, {|a = \"12\"| var c = 'b'.kr; Out.ar(0, FSinOsc.ar(b))})"
  35. );
  36. Gist.contentAsJsonString(content)
  37. )
  38.  
  39.  
  40. ( // post new gist
  41. var descr = "My 44th API submittet SynthDef gist";
  42. var public = true;
  43. var content = (
  44. 'SynthDef.sc': "SynthDef(\"out\", {Out.ar(0, FSinOsc.ar(247); \\haha)})"
  45. );
  46.  
  47. q.postGist(descr, content, public, q.username, q.password);
  48. )
Add Comment
Please, Sign In to add comment