Skip to content

Instantly share code, notes, and snippets.

# Pipe command to this to open in the browser (eg. bundle help install | pb)
alias pb="col -b | open -a /Applications/Chromium.app -f"

Keybase proof

I hereby claim:

  • I am dirk on github.
  • I am dirk (https://keybase.io/dirk) on keybase.
  • I have the public key with fingerprint 30B2 92C2 31E4 F85D 4B82  97CE DC57 4905 5034 B546

To claim this, I am signing this object:

vhost.conf:
<VirtualHost *:80>
<Directory "/sites.../app">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
DocumentRoot "/sites.../app/public"
ServerName app.dev
</VirtualHost>
fish:~ $ gobjdump -T /usr/lib/system/libsystem_c.dylib | grep rb
00000000000704b7 l 0e SECT 01 0000 [.text] _rb_tree_removal_rebalance
0000000000070602 l 0e SECT 01 0000 [.text] _rb_tree_reparent_nodes
00000000000907e8 l 0e SECT 0f 0000 [.bss] _sbrk_curbrk
00000000000910f0 l 0e SECT 0f 0000 [.bss] _nextcomp.lmsgverb
00000000000704a4 g 0f SECT 01 0000 [.text] _rb_tree_count
000000000006febe g 0f SECT 01 0000 [.text] _rb_tree_find_node
000000000006ff1a g 0f SECT 01 0000 [.text] _rb_tree_find_node_geq
000000000006ff85 g 0f SECT 01 0000 [.text] _rb_tree_find_node_leq
000000000006fe95 g 0f SECT 01 0000 [.text] _rb_tree_init

...

Read this first: Server setup and provisioning sucks donkey dick. Ansible sucks even more donkey dick. However, it sucks less donkey dick than any other tools out there for this god-forsaken fuck-fest they call "dev-ops". So let's use Ansible.

...

@dirk
dirk / diff.rb
Created November 27, 2008 14:58
require 'diff-0.4/lib/algorithm/diff'
a = 'testing
sled
123
testing'
ab = a.dup
b = 'testing
sledding across the white snow
123error
@dirk
dirk / simple_constrictor_application.py
Created April 18, 2009 18:21
Extremely simple Constrictor app, connects to database, grabs the user table, and returns a list of users.
# Suggested directory structure:
# /myapp/this_file.py
# /constrictor
# This is to load the path above it to add constrictor directory to the path.
import os, sys
sys.path.append(os.path.join(os.getcwd(), os.pardir))
# Recommended to make pathing easier. (Note: Requires os module)
from constrictor.utils import set_path
<?php
$now = microtime(true);
for($i = 0; $i < 1000000; $i++){
$str = 2 + 'characters';
}
echo microtime(true) - $now;
$now = microtime(true);
for($i = 0; $i < 1000000; $i++){
$str = 2 . 'characters';
}
# heavily based off difflib.py - see that file for documentation
# ported from Python by Bill Atkins
# This does not support all features offered by difflib; it
# implements only the subset of features necessary
# to support a Ruby version of HTML Differ. You're welcome to finish this off.
# By default, String#each iterates by line. This isn't really appropriate
# for diff, so often a string will be split by // to get an array of one-
# character strings.
class Project
include MongoMapper::Document
key :name, String, :required => true
key :description, String, :default => ''
key :status, Symbol, :required => true, :default => :open
key :client_id, ObjectId, :required => true
belongs_to :client
many :tasks, :dependent => :destroy