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
## 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
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
{ | |
"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 Main where | |
import System.Environment | |
main :: IO () | |
main = do | |
args <- getArgs | |
mapM_ putStrLn $ sort args | |
sort :: (Ord a) => [a] -> [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
module Main where | |
import System.Environment | |
main :: IO () | |
main = do | |
args <- getArgs | |
mapM_ putStrLn $ sort args | |
sort :: (Ord a) => [a] -> [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
## Making Option[[]], Option[{}] and Option[""] return None | |
Looked at a certain way, it does make a kind of sense. I can see how you got the idea. | |
A None is itself a kind of empty collection, so why wouldn't an Option of an empty collection also be a None? | |
However, I think there are some important things we need to consider. | |
The first one is - why would you be creating an optional collection - what value would you be getting from doing so? | |
And what value would you be getting from empty collections being interpreted as None? |
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
normal score: 41 (4 then 1) | |
spare: 3/ | |
strike: X | |
score then gutter: 4- | |
34X--3/34 |
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 DCode | |
def initialize(assessment, user) | |
@assessment = assessment | |
@user = user | |
end | |
def code | |
"#{site.name[0,2]}-#{department_code}".upcase | |
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
-module(infinite). | |
-compile(export_all). | |
%%% Usage | |
% | |
% Ints = infinite:stream(0, fun (X) -> X + 1 end). | |
% | |
% % Numbers from 0 to 9 | |
% infinite:take(Ints, 10). | |
% |