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
Bacon=require("baconjs") | |
s = Bacon.later(1000, "hello") | |
b = new Bacon.Bus() | |
b.plug(s) | |
b.log() |
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
[user] | |
name = Juha Paananen | |
email = juha.paananen@gmail.com | |
[color] | |
ui = auto | |
diff = true | |
[alias] | |
st = status | |
stp = status --porcelain | |
br = branch |
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
waitForAngular = function(el, angular, callback) { | |
try { | |
angular.element(el).injector().get('$browser').notifyWhenNoOutstandingRequests(callback); | |
} catch (e) { | |
callback(e); | |
} | |
}; |
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 node | |
var fs = require("fs") | |
var files = process.argv.slice(2) | |
if (!files.length) { | |
console.log("USAGE: depth.js file1 [file2 ...]") | |
} | |
files.forEach(function(filename) { | |
var object = JSON.parse(fs.readFileSync(filename)) | |
console.log(filename, depth(object, "")) | |
function depth(object, path) { |
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
module ByteStringHelper where | |
import Data.ByteString as B | |
import Data.String | |
unpack :: B.ByteString -> String | |
unpack = read . show | |
pack :: String -> B.ByteString | |
pack = read . show |
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
module Transactional(Transactional, Connection, transactionally, getConnection) where | |
data Connection = Connection | |
data Transactional a = Transactional (Connection -> IO a) | |
instance Monad Transactional where | |
(>>=) op toNext = Transactional $ \conn -> perform conn op >>= perform conn . toNext | |
return a = Transactional $ return . const a | |
getConnection :: Transactional Connection |
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 android.accounts.Account; | |
import android.accounts.AccountManager; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.app.Dialog; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.util.Log; |
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 OverloadedStrings, DeriveDataTypeable, NoMonomorphismRestriction #-} | |
module AesonTest where | |
import qualified Data.Aeson.Generic as A | |
import qualified Data.ByteString.Lazy as L8 | |
import Data.Data | |
import Data.Typeable | |
import Codec.Binary.UTF8.String as U8 | |
import Data.Maybe |
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 Text.Regex.XMLSchema.String(match, sed) | |
clean :: String -> String | |
clean = sed (const "><") ">\\s*<" . trim | |
where trim = dropWhile whitespace . reverse . dropWhile whitespace . reverse | |
whitespace c = match "\\s" [c] |
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
package com.karma.cache | |
import collection.immutable.HashMap | |
trait Cache[K, V] { | |
def get(key : K, fetch : (K => V)) : V | |
} | |
class NoCache[K, V] extends Cache[K, V] { | |
def get(key : K, fetch : (K => V)) : V = fetch(key) |
OlderNewer