This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extend Encrypter::Encryptable | |
# encrypt :email, :password | |
class Encrypter | |
def self.encrypt val | |
encrypter.encrypt val | |
end | |
def self.decrypt val | |
encrypter.decrypt val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp import util | |
from django.utils import simplejson as json | |
from google.appengine.ext import db | |
import re | |
import pdb, sys | |
debugger = pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by git-commit with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# To enable this hook, make this file executable. | |
# This is slightly modified from Andrew Morton's Perfect Patch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var view = new View(); | |
view.template("show", function() { /* | |
Hello World | |
*/ }); | |
view.template("edit", function() { /* | |
<%= str %> | |
*/ }); | |
test("can render", function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'appscript' | |
require 'ftools' | |
it = Appscript.app('iTunes') | |
['80s Mix', 'Ridiculously awesome'].each do |playlist| | |
it.playlists[playlist].tracks.get.each do |track| | |
from = track.location.get.to_s | |
to = '/Volumes/ANDROID/Music' + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("pass through", function() { | |
function increment(i) { return i + 1; } | |
function asyncIncrement(i, callback) { | |
async(function() { callback(i + 1); }); | |
} | |
function asyncIncrement2(i) { | |
var d = new Deferred().pause(); | |
async(function() { d.restart(i + 1); }); | |
return d; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def memcache(func): | |
def cached(*args): | |
key = pickle.dumps((func.__name__, args)) | |
cache = Memcache.get(key) | |
if (cache): | |
logging.info("cache hit for %s" % func.__name__) | |
return pickle.loads(cache) | |
value = func(*args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServerJuice | |
attr_reader :script_name, :server, :hostname | |
def initialize(script_name, server, hostname, mysql_password = "") | |
@script_name = script_name | |
@server = server | |
@hostname = hostname | |
@mysql_password = mysql_password | |
end |
NewerOlder