Skip to content

Instantly share code, notes, and snippets.

joshjordan /
Last active November 25, 2019 23:48
Initialize a new machine with my preferred applications and configurations
git clone --recursive "${ZDOTDIR:-$HOME}/.zprezto"
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^; do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
git clone ~/zprezto_custom
ln -s ~/zprezto_custom/prompt_joshjordan_setup ~/.zprezto/modules/prompt/functions/prompt_joshjordan_setup
View Procfile
golang: go run go-producer.go
redis: redis-server
ruby: sidekiq -r './ruby-consumer.rb'
joshjordan / lenskit.rb
Last active October 2, 2017 13:42
Example showing usage of lenskit from Ruby, via JRuby.
View lenskit.rb
require 'jbundler'
require 'example_runner'
#In a real application, include this module in your Ruby class
include ExampleRunner
user_ids.each do |user_id|
puts "Recommendations for user with id=#{user_id}:"
puts " #{item_recommender.recommend(user_id, 5)}"
View donuts.ps1
$Rewards = "Donuts","Cookies","Steak","Bacon","Cupcakes","Truffles","Chocolates","Snacks","Breakfast","Lunch","Back rubs","Burgers","Pancakes","High fives","Coconuts","Cheesecake","Stamps"
$sendDateTime = (Get-Date)
Write-Output ($sendDateTime -lt (Get-Date))
if($sendDateTime -lt (Get-Date))
$ChosenReward = $Rewards | Get-Random
joshjordan /
Created August 18, 2016 04:35
Simple script to connect to a dynamic proxy via SSH and connect your local OS X wifi to it via SOCKS. Disconnects on CTRL+C
# Set PROXY_HOST to the SSH proxy hostname (optionally, include a username)
# Override PROXY_PORT if necessary
sudo -s <<EOF
trap clear_proxy INT
function clear_proxy() {
echo "Disconnecting proxy..."
joshjordan / to_csv.rb
Last active August 4, 2016 02:50
Snippet that saves an array of hashes to a CSV file easily
View to_csv.rb
require 'csv'
class Array
def to_csv(csv_filename, homogeneous_headers = false)
return unless self.any?
headers = if homogeneous_headers
self.inject([]) { |memo, row| memo |= row.keys; memo }

Keybase proof

I hereby claim:

  • I am joshjordan on github.
  • I am joshjordan ( on keybase.
  • I have a public key whose fingerprint is 017B 4FEC 0D82 7646 A7BA F2B3 AD81 8BB5 E132 FB8A

To claim this, I am signing this object:

joshjordan / polyfills.js
Created March 8, 2016 00:19
d3 deconstructor polyfills
View polyfills.js
SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(elem) {
return elem.getScreenCTM().inverse().multiply(this.getScreenCTM());
// SVGPathSeg API polyfill
// This is a drop-in replacement for the SVGPathSeg and SVGPathSegList APIs that were removed from
// SVG2 (, including the latest spec
joshjordan / prompt_joshjordan_setup
Last active January 16, 2016 22:47
Simple prezto prompt with working directory and git info on the left prompt, and current time on right prompt.
View prompt_joshjordan_setup
# My prezto prompt. Simplified version of (read: almost completely lifted from) steeef theme
function prompt_joshjordan_precmd {
# Check for untracked files or updated submodules since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
View method-cache-test.rb
require 'benchmark'
module A
class DefinedMethodStyle
def dont_bust_cache(*)