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
view.fn 'unwrap', (ob) -> | |
{ key, value } for own key, value of ob) |
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
class A | |
include Mongoid::Document | |
embeds_one :b | |
end | |
class B | |
include Mongoid::Document | |
embedded_in :a | |
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
class A | |
include Mongoid::Document | |
has_many :bs | |
end | |
class B | |
include Mongoid::Document | |
belongs_to :a | |
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
# This is LiveScript, really, but GH can't colour it -- yet. | |
time = (n, target) -> | |
t0 = (new Date).getTime! | |
for i from 1 to n then r = target! | |
t = (new Date).getTime! - t0 | |
ta = t / n | |
console.log "[time] #t ms (avg #ta ms)" | |
r |
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
// nb. we have a typo with occurrences -- sometimes they are called "occurences". | |
var filter = {}; | |
var projection = { | |
_id : true, | |
facebook_occurence_ids : true | |
}; | |
db.movies.find(filter, projection) |
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
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <sys/time.h> | |
using namespace std; | |
typedef vector<int> vec; | |
typedef vector<int>::iterator ix; |
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
express = require \express | |
app = express! | |
..set \views, "#__dirname/../views" | |
..use express.static "#__dirname/../pub" | |
app.get '/', (req, res) -> | |
res.render 'index.jade' | |
app.listen 3001 |
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
#lang racket | |
;; | |
;; Run-of-the mill metacircular evaluator for (a small subset of) scheme. | |
;; Includes delimited continuations, and the tower of (positive) meta-levels. | |
;; | |
(struct closure [vars body environment]) | |
(struct primitive [procedure]) |
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
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} | |
{-# LANGUAGE OverlappingInstances, UndecidableInstances #-} | |
module Peek ( | |
module Data.Monoid | |
, Store, runStore, store, stores | |
, Restorable, restore | |
, AutoSize, autoSizeOf | |
) where |
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
{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-} | |
{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances #-} | |
module GenS (AutoStorable) where | |
import Control.Applicative | |
import GHC.Generics | |
import Data.Word | |
import Foreign |
OlderNewer