Skip to content

Instantly share code, notes, and snippets.

View gf3's full-sized avatar
🍊
workin' goodly

Gianni Chiappetta gf3

🍊
workin' goodly
View GitHub Profile
/* compiler output */
SExp *member0_p (SExp *, SExp *);
SExp *
member0_p (SExp * x, SExp * l)
{
SExp *ret = nil, *x2 = nil, *l3 = nil;
int s1 = 1;
while (s1)
{
@stouset
stouset / foo.rb
Created December 1, 2011 01:24
autoload best practice
class Foo
autoload :Bar, 'foo/bar'
autoload :Baz, 'foo/baz'
end
@cblunt
cblunt / Gemfile
Created October 21, 2011 08:55
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@wereHamster
wereHamster / Coffeescript ctags
Created October 19, 2011 18:25 — forked from mads-hartmann/Coffeescript ctags
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
# Detects classes, static/class methods, plain functions and variables.
--regex-coffee=/^class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\1/c,class/
--regex-coffee=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
@mattwynne
mattwynne / gist:1228927
Created September 20, 2011 11:52
eventually helper method for making assertions against asynchronous systems
# usage:
# it "should return a result of 5" do
# eventually { long_running_thing.result.should eq(5) }
# end
module AsyncHelper
def eventually(:options = {})
timeout = options[:timeout] || 2
interval = options[:interval] || 0.1
time_limit = Time.now + timeout
loop do
@lojikil
lojikil / gist:1131925
Created August 8, 2011 15:10
SRFI Bookmarklet
javascript:(function(){i=prompt("SRFI Number");window.location="http://srfi.schemers.org/srfi-"+i+"/srfi-"+i+".html";})()
@danking
danking / gist:1068185
Created July 6, 2011 19:55
A very simple example showing how to use Racket's lexing and parsing utilities
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
parser-tools/yacc)
(provide (all-defined-out))
(define-tokens a (NUM VAR))
(define-empty-tokens b (+ - EOF LET IN))
(define-lex-trans number
(syntax-rules ()
@gf3
gf3 / ago.js
Created June 2, 2011 18:43
Super small relative dates
module.exports = (function(){
const MS =
{ seconds: 1000
, minutes: 60 * 1000
, hours: 60 * 60 * 1000
, days: 24 * 60 * 60 * 1000
, weeks: 7 * 24 * 60 * 60 * 1000
, months: 30 * 7 * 24 * 60 * 60 * 1000
, years: 365 * 24 * 60 * 60 * 1000 }
@alexrozanski
alexrozanski / gist:972958
Created May 15, 2011 08:00
Reposition Traffic Lights
NSButton *closeButton = [self standardWindowButton:NSWindowCloseButton];
NSView *themeFrame = [closeButton superview];
CGFloat buttonYOrigin = NSMaxY(themeFrame.frame)-34;
//Alter the button frames
NSRect closeFrame = closeButton.frame;
closeFrame.origin.y = buttonYOrigin;
closeButton.frame = closeFrame;
@lenary
lenary / gitconfig.ini
Created February 18, 2011 01:21
a special excerpt of my gitconfig
$ git clone github:lenary/guides.git
Cloning into guides...
remote: Counting objects: 255, done.
remote: Compressing objects: 100% (216/216), done.
remote: Total 255 (delta 111), reused 163 (delta 35)
Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done.
Resolving deltas: 100% (111/111), done.
$ cd guides
$ git remote -v