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
{ | |
"created_at": "Sun Aug 04 20:08:59 +0000 2013", | |
"id": 364115772693430300, | |
"id_str": "364115772693430272", | |
"text": "@jamescotterill Congratulations, Tintin!", | |
"source": "<a href=\"http://tapbots.com/software/tweetbot/mac\" rel=\"nofollow\">Tweetbot for Mac</a>", | |
"truncated": false, | |
"in_reply_to_status_id": 364104514800222200, | |
"in_reply_to_status_id_str": "364104514800222208", | |
"in_reply_to_user_id": 14436601, |
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
module Daodalus | |
module EventMachineSupport | |
def collection | |
db.collection(collection_name) | |
end | |
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
## add the following to your Gemfile | |
gem 'headless' |
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 'faraday' | |
require 'yajl' | |
require 'id' | |
class Subject | |
include Id::Model | |
field :type | |
field :value |
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
# set up java | |
sudo apt-get install openjdk-7-jdk | |
echo "export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64" >> ~/.bashrc | |
# get nutch 1.7 | |
curl "http://mirror.ox.ac.uk/sites/rsync.apache.org/nutch/1.7/apache-nutch-1.7-bin.tar.gz" > nutch.tar.gz | |
tar zxvf nutch.tar.gz | |
cd ~/apache-nutch-1.7 | |
# add some urls to crawl (optionally use seeds.txt in this gist) |
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
module Id::Model | |
def initialize(data = {}) | |
@data = data.reduce({}) do |acc, (k, v)| | |
field = fields[k.to_sym] | |
v ||= field.default! | |
v = field.type.new(v) if field.type.is_a?(Id::Model) && !v.nil? | |
acc.merge(k.to_s => Id::Hashifier.enhash(v)) | |
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
-- Short version to show the power of Haskell :-) | |
module DNA(toRNA) where | |
toRNA = map convert where | |
convert 'T' = 'U' | |
convert n = n | |
-- Long version with a bunch of cool stuff that makes me happy |
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
use strict; | |
use warnings; | |
{ | |
package Bob; | |
sub hey { | |
if (&_shouting) { | |
"Woah, chill out!" | |
} elsif (&_question) { |
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
(ns request) | |
(defn request [] {}) | |
(defn body [] {}) | |
(defn file [] {}) | |
(defn set-url | |
[request url] | |
(assoc request :url url)) |
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 Board | |
def squares | |
@squares ||= [[:_, :_, :_],[:_, :_, :_],[:_, :_, :_]] | |
end | |
def square(x, y) | |
squares[y][x] | |
end | |
def place(counter, x, y) |