Skip to content

Instantly share code, notes, and snippets.

@kates
kates / tmpl.js
Created September 9, 2011 10:49
faster resig micro template
(function(window){
window.tmpl = function(str, c) {
var c = c || "it";
return new Function(c,
"var p=[];p.push('" +
str.replace(/[\r\t\n]/g, " ")
.replace(/'(?=[^<]*%>)/g,"\t")
.replace(/'/g, "\\'")
.replace(/\t/g, "'")
.replace(/<%=(.+?)%>/g, "',$1,'")
@kates
kates / bf.py
Created May 23, 2011 14:37
brainfuck interpreter in python
"""
bf.py
Brainfuck interpreter written in python.
Does not handle input :(
"""
import sys
def run(src):
c = [0] * 30000
p = 0
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
#!/usr/bin/env ruby
require 'rubygems'
require 'highline'
require 'optparse'
require 'etc'
current_user = Etc.getpwuid
OPTIONS = {