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
;; Deriving something like generators, but I didn't really feel like | |
;; doing exactly that. | |
;; It doesn't, for instance, support sending back into the generator | |
;; This applys a function across a range from 0 to x. | |
(define (apply-to-range f i x) | |
(when (< i x) | |
(f i) | |
(apply-to-range f (+ 1 i) x))) |
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
#!/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)) |
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
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 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
/* 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 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 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 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 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
end | |
end |
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
# 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 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 '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 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
source :gemcutter | |
gem 'goliath', :git => 'git://github.com/postrank-labs/goliath.git' | |
gem 'em-http-request', :git => 'git://github.com/igrigorik/em-http-request.git' | |
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git' | |
gem 'yajl-ruby' |
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
# This is just an hint for a simple Redis caching "framework" using Sinatra | |
# A friend of mine asked for something like that, after checking the first two gems realized there was | |
# a lot of useless complexity (IMHO). That's the result. | |
# | |
# The use_cache parameter is useful if you want to cache only if the user is authenticated or | |
# something like that, so you can do cache_url(ttl,User.logged_in?, ...) | |
require 'rubygems' | |
require 'sinatra' | |
require 'redis' |
OlderNewer