This file contains 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 'rack' | |
require 'sinatra' | |
require 'sinatra/async' | |
require 'em-http-request' | |
# Trying out sinatra in async request mode. | |
# | |
# Run it like so: | |
# | |
# thin -R test.rb -p 4000 start |
This file contains 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
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs) | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
# Enable the 2D Dock | |
defaults write com.apple.dock no-glass -bool true | |
# Make Dock icons of hidden applications translucent | |
defaults write com.apple.dock showhidden -bool true | |
# Disable menu bar transparency |
This file contains 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 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
end | |
end |
This file contains 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 pandas import DataFrame | |
from pandas.util.testing import set_trace | |
import os | |
import numpy as np | |
import matplotlib.pyplot as plt | |
dirs = [] | |
names = [] | |
lengths = [] |
This file contains 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
import java.io.*; | |
import java.util.*; | |
class Singleton { | |
private static Singleton _Instance; | |
private Singleton() | |
{ | |
} |
This file contains 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
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011 | |
* http://benalman.com/ | |
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ | |
(function($) { | |
var o = $({}); | |
$.subscribe = function() { | |
o.on.apply(o, arguments); |
This file contains 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
import boto.mturk | |
import boto.mturk.connection | |
import boto.mturk.price | |
from boto.mturk.question import * | |
import sys | |
question = QuestionForm([ | |
Question( | |
identifier=1, | |
content=QuestionContent([ |
This file contains 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
# grep.py | |
# | |
# A very simple coroutine | |
def grep(pattern): | |
print "Looking for %s" % pattern | |
while True: | |
line = (yield) | |
if pattern in line: | |
print line, |
This file contains 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
#simple decorators concept from... | |
#http://stackoverflow.com/questions/739654/understanding-python-decorators | |
def makebold(fn): | |
def wrapped(): | |
return "<b>" + fn() + "</b>" | |
return wrapped | |
def makeitalic(fn): | |
def wrapped(): |
This file contains 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
#!/usr/bin/env python2 | |
from itertools import combinations | |
def number_of_disc_intersections(A): | |
boundries = list() | |
for x, r in enumerate(A): | |
boundries.append((x-r, x+r)) | |
r = range(len(A)) |