Skip to content

Instantly share code, notes, and snippets.

window.fbAsyncInit = function() {
FB.Event.subscribe('edge.create', function(response) {
alert('Thanks for liking!');
console.log(resposne);
});
FB.Event.subscribe('edge.remove', function(response) {
alert('Sad to see you dont like me :(');
console.log(response);
});
isTrigger() // returns true or false whether or not in Trigger.io environment
request.get(url, callback) // will use Trigger's request.get or $.ajax JSONP
log.info(message) // logger helper that will use Trigger's logger or console.log
// available log levels are debug, info, warning, error, critical
// See https://github.com/abronte/TriggerHelpers/blob/master/src/logger.coffee
brunch new MyApp --skeleton git@github.com:abronte/brunch-with-trigger.git
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
@abronte
abronte / gist:3763216
Created September 21, 2012 18:55
BigQuery gem example
require 'bigquery'
opts = {}
opts['client_id'] = '1234.apps.googleusercontent.com'
opts['service_email'] = '1234@developer.gserviceaccount.com'
opts['key'] = '/path/to/somekeyfile-privatekey.p12'
opts['project_id'] = '54321'
opts['dataset'] = 'yourdataset'
bq = BigQuery.new(opts)
tell application "Google Chrome"
activate
set theUrl to "http://calendar.google.com"
if (count every window) = 0 then
make new window
end if
tell window 1 to make new tab with properties {URL:theUrl}
end tell
filetype on
augroup vimrc_filetype
autocmd!
autocmd FileType ruby call s:RubyCommenter()
autocmd FileType vim call s:VimCommenter()
augroup end
map _ :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>:nohlsearch<CR>
" Clear all types of comments
map _ :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR>:nohlsearch<CR>
" Add a # comment at the begining
map - :s/^/#/<CR>:nohlsearch<CR>
@abronte
abronte / gist:2306690
Created April 5, 2012 00:03
LFTP sync
#!/bin/bash
HOST="email.com:1234"
USER="username"
PASS="password"
LCD="/path/to/local/dir"
RCD="/path/to/remote/dir"
if [ ! -e "/tmp/xfer" ]
then
touch /tmp/xfer
@abronte
abronte / gist:2143903
Created March 21, 2012 02:49
String Distance
stringDistance: function(s1, s2) {
// sift3: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html
if (s1 == null || s1.length === 0) {
if (s2 == null || s2.length === 0) {
return 0;
} else {
return s2.length;
}
}