Skip to content

Instantly share code, notes, and snippets.

@jordelver
jordelver / gist:4430514
Created January 1, 2013 22:26
zsh-newuser-install

If you want to run the zsh new user setup, but have run it previously, do the following:

autoload zsh-newuser-install
zsh-newuser-install -f
@jordelver
jordelver / gist:3818839
Created October 2, 2012 12:51
Functional TDD: A Clash of Cultures - Kent Beck

Functional TDD: A Clash of Cultures - Kent Beck

https://www.facebook.com/notes/kent-beck/functional-tdd-a-clash-of-cultures/472392329460303

I have been taking Bryan O'Sullivan's excellent Haskell course and noticed something during the homework: TDD wasn't working for me, at least not as I apply it in object languages. This has forced me to take a step back and rethink what is really essential about TDD and what is an artifact of the languages I have been using.

A warning: I'm only on week two of the course. I did quite a bit of functional programming in the Dinosaur Computing Era, so the style is familiar, but everything contained herein is subject to change. I'm mostly just thinking aloud (and hoping for contributed wisdom.)

When I use TDD with an object language like Smalltalk, Java, or PHP I typically start programming with a trivial case--a List with no elements, for example. Working through it encourages me (sounds better than "forces") to think about the metaphors I am using and style of the API

@jordelver
jordelver / gist:3073101
Created July 8, 2012 22:06
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

Keybase proof

I hereby claim:

  • I am jordelver on github.
  • I am jordelver (https://keybase.io/jordelver) on keybase.
  • I have a public key whose fingerprint is FCF1 85F0 6DBF 112D 8F8E DEEC CAE8 72D7 E87D 5AFF

To claim this, I am signing this object:

@jordelver
jordelver / gist:4436476
Created January 2, 2013 17:58
7 Patterns to Refactor Fat ActiveRecord Models
@jordelver
jordelver / gist:3819526
Created October 2, 2012 14:24
base64 encoding and decoding
@jordelver
jordelver / gist:3729761
Created September 15, 2012 21:05
5 Reasons You Should Use ri To Read Ruby Documentation
@jordelver
jordelver / gist:3139365
Created July 18, 2012 22:29
How to write an image file to an SD card under Mac OS X (for Raspberry Pi)

Find the SD card device

In this case, the SD card is /dev/disk4. DO NOT get this wrong or you may destroy all the data on the wrong disk/card/drive.

diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0

1: EFI 209.7 MB disk0s1

@jordelver
jordelver / gist:3790808
Created September 26, 2012 21:45
Destructuring assignment in Ruby and splats!
# Destructuring assignment in Ruby
# http://po-ru.com/diary/destructuring-assignment-in-ruby/
numbers = [ 1, 2, 3, 4, 5]
=> [1, 2, 3, 4, 5]
# Destructuring assignment
a, b, c = numbers
@jordelver
jordelver / gist:5806460
Created June 18, 2013 15:41
Sharing files using netcat

Sharing files using netcat

The receiver

nc -l 5566 > data-dump.sql

Listen on port 5566 and redirect output to data-dump.sql

The sender