Skip to content

Instantly share code, notes, and snippets.

@pd
pd / uuid-vs-sha1.rb
Created October 27, 2014 13:26
UUID v5 vs SHA1 hexdigest
require 'json-schema'
require 'digest/sha1'
require 'benchmark'
N = 5000
SCHEMAS = Dir['test/schemas/*.json'].map { |f| File.read(f) }
Benchmark.bmbm do |x|
x.report('v5') do
N.times do
@pd
pd / keybase.md
Last active January 8, 2020 01:22
Keybase proof of identity.

Keybase proof

I hereby claim:

  • I am pd on github.
  • I am pd (https://keybase.io/pd) on keybase.
  • I have a public key ASCAInw0XoV-EBb31ilHLmST9jfq84TBV-T06XS-XnJtVAo

To claim this, I am signing this object:

@pd
pd / example.txt
Created August 8, 2013 18:12
let's call it an mvp
$ npm i esprima falafel
$ node sib.js | node
{ '4': [ [ 2, 'big' ], [ 2, 'big' ] ],
'8': [ [ 6, 'little' ] ],
'11': [ [ 11, 'big' ], [ 11, 'little' ] ] }
@pd
pd / 00_before.txt
Last active December 20, 2015 16:19
puzzle 0 solved in 111ms
puzzle 1 solved in 387ms
puzzle 2 solved in 403ms
puzzle 3 solved in 18174ms
puzzle 4 solved in 5284ms
puzzle 5 solved in 59081ms
puzzle 6 solved in 17535ms
puzzle 7 solved in 240ms
puzzle 8 solved in 13946ms
puzzle 9 solved in 19302ms
bindings combos.mash,
'R': -> App.reloadConfig
'F': (win) -> win.maximize
'U': relocate (loc) -> loc.fillColumn()
'H': relocate (loc) -> loc.move('column', -1)
'J': relocate (loc) -> loc.move('row', 1)
'K': relocate (loc) -> loc.move('row', -1)
'L': relocate (loc) -> loc.move('column', 1)
@pd
pd / clone.sh
Last active December 10, 2015 21:29 — forked from anonymous/window_layout_spec.rb
mkdir -p read_window_layout/features/support
curl https://gist.github.com/raw/4495802/9d28d175fc1808e86e29248df793c01460cf7119/read-layout.feature > read_window_layout/features/read-layout.feature
curl https://gist.github.com/raw/4495802/ba67bac9506bda4522883f19c118fef23604db9e/features-support-env.rb > read_window_layout/features/support/env.rb
@pd
pd / api-auth-profiling.rb
Created November 3, 2015 19:49
Quick script to benchmark & profile ApiAuth request validation
# Don't use bundle. Run from your api_auth checkout.
#
# ENV:
# V = {local, gem}
# use an installed gem, or the current working dir
# M = {bench, object, cpu, wall}
# run benchmark/ips, or choose to profile object allocations or cpu cost
require 'benchmark/ips'
require 'pry'
xmonad.hs:155:7:
Ambiguous occurrence `font'
It could refer to either `XMonad.Prompt.font',
imported from XMonad.Prompt at xmonad.hs:26:1-20
or `Dzen.font',
imported from Dzen at xmonad.hs:35:1-11
(defined at lib/Dzen.hs:89:7)
describe 'an ApplicationController spec', :shared => true do
before(:all) do
ActionController::Routing::Routes.draw do |map|
map.resources :foo
map.connect '/access', :controller => 'foo', :action => 'access', :conditions => { :method => :put }
map.login '/login', :controller => 'foo', :action => 'index'
end
end
after(:all) do
# Run this from oly-dev
rm -rf */vendor/libs/{aasm,haml,rspec_hpricot_matchers}
rm -rf */vendor/plugins/{better_partials,cucumber,rspec,webrat,will_paginate}
rm -rf */vendor/rails