Skip to content

Instantly share code, notes, and snippets.

@visnup
visnup / README.js
Created November 15, 2010 21:36 — forked from igrigorik/webapp.rb
node.js version inspired by igrigorik's any ruby object, as a webapp! 'cause we can too.
#!/usr/bin/env node
var http = require('http')
, webapp = require('webapp');
http.createServer(webapp.bind([])).listen(8000);
// ^^^^^^^^^^^^^^^
// | (x)
// ROFLSCALE DEQUE ---/
@lfborjas
lfborjas / continuation.rb
Created March 28, 2011 11:18
Examples of continuations
class Array
def one_at_a_time
control_state = lambda do |ret|
each do |elem|
callcc do |resume|
control_state = lambda do |r|
resume.call r
end
ret.call elem
end
@tekacs
tekacs / show
Created April 20, 2011 17:55
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@lfborjas
lfborjas / .vimrc
Created July 26, 2011 22:24 — forked from jeresig/.vimrc
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
events =
events: {}
bind: (topic, handler, context = this) ->
(@events[topic] ||= []).push { handler, context }
trigger: (topic, args...) ->
if @events[topic]?
event.handler.apply event.context, args for event in @events[topic]
@polotek
polotek / backbone_plus_cs.md
Created July 29, 2012 18:07
Some thoughts on a small project with Backbone and CoffeeScript

I spent some time on a little scripting project yesterday and decided to use Backbone and CoffeeScript. I've been looking for a reason to use Backbone just to become more familiar. I don't really use CoffeeScript, and even went through my periods as a CS hater. But it's always a good idea to stay familiar with what's out there. At the very least it'll make sure you're not full of shit when you talk to people about pros and cons. Anyway, this isn't comprehensive or even useful per se. I just thought I'd jot down some thoughts.

I should make a disclaimer that this wasn't a traditional project for Backbone. It was a node script that only uses models a collections. I needed to perform a bunch of actions on a dataset by hitting a REST api. I've been thinking for a while that tasks like this are often nicer if you can mock up a quick model domain around the api. Then you can work with Forum and Topic models and just do update and delete operations on them. Once you set these up, the scripting tasks become much mor

@textarcana
textarcana / cucumber_cheatsheet.markdown
Created December 22, 2009 01:47
Cucumber cheatsheet

Cucumber cheatsheet

Best cheatsheet is: cucumber --help

Output formats

Reporting

Notification formats, in increasing order of verbosity:

###
# Scheme code is translated to YARV byte code, then evaluated in the
# Ruby Virtual Machine
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
class RubyVM
@ryanb
ryanb / favorite_gems.md
Created March 4, 2011 17:31
A list of my favorite gems for various tasks.