Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
/* | |
* To try it: | |
* c = $c.sRGB8(23,58,32); | |
* c.Lab(); | |
* c.Lab().sRGB8(); | |
*/ | |
var $c = {}; | |
( | |
function () { |
# robgleeson's fork much improved | |
class ErrorDelegate | |
attr_reader :pointer | |
alias_method :to_pointer, :pointer | |
def initialize | |
@pointer = Pointer.new_with_type '@' | |
end |
#!/usr/bin/env ruby | |
# 2011-10-10 20:57:53 +1000 | |
def merge_sort(a) | |
return a if a.size <= 1 | |
l, r = split_array(a) | |
result = combine(merge_sort(l), merge_sort(r)) | |
end |
$graph = {a: [:b, :c], b: [:d, :e], c: [:f, :g]} | |
def dfs_nr(node) | |
queue = [node] | |
seen = {} | |
while not queue.empty? | |
node = queue.pop | |
puts node | |
seen[node] = true | |
if $graph[node] |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
#!/usr/bin/env ruby | |
# code2png - Render code to an image on OS X | |
# Peter Cooper (@peterc) | |
# MIT license | |
# | |
# code2png converts source code into a PNG graphic | |
# (with syntax coloring, if you want). Ideal for | |
# Kindle document production, RSS feeds, etc. | |
# |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
import os | |
import i3 | |
import sys | |
import pickle | |
def showHelp(): | |
print(sys.argv[0] + " <save|restore>") | |
def get_visible_workspace(): | |
for workspace in i3.get_workspaces(): |
# -*- coding: utf-8 -*- | |
$:.unshift("/Library/RubyMotion/lib") | |
require 'motion/project' | |
require 'motion-cocoapods' | |
require 'bundler' | |
Bundler.require | |
Dir.glob('lib/tasks/*.rake').each { |r| import r } | |
VERSION = "1.0.2" |
body { | |
background: #f3f3f3; | |
} | |
.card { | |
background: url(http://i.imgur.com/wpb9BKE.jpg) center center white; | |
width: 350px; | |
height: 303px; | |
box-shadow: 0 1px 2px rgba(0,0,0,0.5); | |
border-radius: 3px 3px; | |
margin: 0 auto 10px; |