Skip to content

Instantly share code, notes, and snippets.

@gjtorikian
gjtorikian / create_file.rb
Created April 16, 2013 19:35
How to create a file using the GitHub v3 API
require 'octokit'
# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
login = ENV['GH_LOGIN']
password = ENV['GH_LOGIN_PASSWORD']
repo = "gjtorikian/crud-test"
client = Octokit::Client.new(:login => login, :password => password)
# grab the current master branch
@gjtorikian
gjtorikian / font-builder
Created March 21, 2013 00:23
Font-builder OS X commands
brew install fontforge
ln -s /opt/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.6.dylib
brew tap sampsyo/py
brew install PyYAML
pip -q install pystache argparse
@gjtorikian
gjtorikian / remove_file.rb
Last active March 20, 2023 03:21
How to remove a file from a subdirectory using the GitHub API v3
#!/usr/bin/env ruby
require 'octokit'
# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
login = ENV['GH_LOGIN']
password = ENV['GH_LOGIN_PASSWORD']
repo = "gjtorikian/crud-test"
master = client.ref(repo, "heads/master")
main( ) {
extrn a, b, c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';
@gjtorikian
gjtorikian / dock.js
Created October 18, 2012 23:22
Setting up a sample dock
dock.addDockable({
expanded : -1,
width : 300,
sections : [
{
width : 260,
height: 350,
buttons : [
{
caption: "My Dock Button",
@gjtorikian
gjtorikian / readFile_queue.js
Created October 15, 2012 10:21
Using async module's queue to avoid EMFILE with fs.readFile
var fs = require("fs"),
async = require("async");
var q = async.queue(function (task, callback) {
if (task.type == "file")
fs.readFile(task.path, "utf8", callback);
}, 250);
dirFiles.forEach(function(path) {
q.push({type: "file", path: path}, function (err, fileString) {
@gjtorikian
gjtorikian / blob.rb
Created September 20, 2012 20:01
ruby blob of jsduck
if exp && ext_define?(exp)
make_class(to_value(exp["arguments"][0]), exp)
# foo = Ext.extend("Parent", {})
elsif exp && assignment?(exp) && ext_extend?(exp["right"])
make_class(to_s(exp["left"]), exp["right"])
# Foo = ...
elsif exp && assignment?(exp) && class_name?(to_s(exp["left"]))
@gjtorikian
gjtorikian / code.js
Created September 18, 2012 18:50
apf code
//#ifdef __DEBUG
if (apf.started)
apf.console.info("including js file: " + sourceFile);
//#endif
var sSrc = doBase ? apf.getAbsolutePath(apf.basePath || "", sourceFile) : sourceFile;
var head = document.getElementsByTagName("head")[0],//$("head")[0]
elScript = document.createElement("script");
//elScript.defer = true;
if (type)
@gjtorikian
gjtorikian / javascript_ast.json
Created September 18, 2012 18:40
javascript ast output
{ type: 'Line', value: '$("head")[0]', range: [ 49981, 49995 ] },
{ type: 'Line',
value: 'elScript.defer = true;',
range: [ 50061, 50085 ] },
{ type: 'Block',
value: '*\n * @private\n ',
range: [ 50757, 50784 ] },
{ type: 'Line',
value: '#ifdef __PARSER_AML',
range: [ 52591, 52612 ] },
@gjtorikian
gjtorikian / ruby_out.json
Created September 18, 2012 18:39
ruby ast output
{
"range": [
49981,
49995
],
"value": "$(\"head\")[0]",
"type": "Line"
},
{
"range": [