Last active
November 2, 2016 18:57
-
-
Save eeropic/209bf8126150f9fb8ca8027c3ac7e69f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gistid="209bf8126150f9fb8ca8027c3ac7e69f"; | |
//Query Github with selected gist id | |
$.ajax({ | |
url: 'https://api.github.com/gists/'+gistid, | |
type: 'GET', | |
dataType: 'jsonp' | |
}).success( function(gistdata) { | |
console.log(gistdata.data.files) | |
var content = gistdata.data.files["appendGistToSketch.js"].content; | |
appendCode(content) | |
}).error( function(e) {console.log('ajax error')}); | |
//Insert the gist to the Ace editor in sketch.paperjs.org | |
function appendCode(data){ | |
source = $('.source'); | |
editor = ace.edit(source.find('.editor')[0]); | |
var session = editor.session; | |
session.insert({row: session.getLength(),column: 0}, | |
"\n" + data) | |
// editor.getValue() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment