Skip to content

Instantly share code, notes, and snippets.

Josh Jordan joshjordan

View GitHub Profile
View Procfile
golang: go run go-producer.go
redis: redis-server
ruby: sidekiq -r './ruby-consumer.rb'
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)
$sendDateTime.AddSeconds(-1)
while($true)
{
Write-Output ($sendDateTime -lt (Get-Date))
if($sendDateTime -lt (Get-Date))
{
$ChosenReward = $Rewards | Get-Random
@joshjordan
joshjordan / socks-proxy.sh
Created Aug 18, 2016
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
View socks-proxy.sh
#!/bin/bash
# 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
joshjordan / to_csv.rb
Last active Aug 4, 2016
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.first.keys
else
self.inject([]) { |memo, row| memo |= row.keys; memo }
end
View keybase.md

Keybase proof

I hereby claim:

  • I am joshjordan on github.
  • I am joshjordan (https://keybase.io/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
joshjordan / polyfills.js
Created Mar 8, 2016
d3 deconstructor polyfills
View polyfills.js
SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(elem) {
return elem.getScreenCTM().inverse().multiply(this.getScreenCTM());
};
// SVGPathSeg API polyfill
// https://github.com/progers/pathseg
//
// This is a drop-in replacement for the SVGPathSeg and SVGPathSegList APIs that were removed from
// SVG2 (https://lists.w3.org/Archives/Public/www-svg/2015Jun/0044.html), including the latest spec
@joshjordan
joshjordan / _zsh-config.sh
Last active Nov 25, 2019
Initialize a new machine with my preferred applications and configurations
View _zsh-config.sh
#!/bin/zsh
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
git clone git@gist.github.com:033fd9f674a670da0460.git ~/zprezto_custom
ln -s ~/zprezto_custom/prompt_joshjordan_setup ~/.zprezto/modules/prompt/functions/prompt_joshjordan_setup
View nvd3-generate-chart-code.js
nv.chartScripts = []
for(var model in nv.models)
{
if(model.match(/[cC]hart$/)) {
(function() {
var currentModel = model;
var chartFunction = nv.models[currentModel];
nv.models[currentModel] = function() {
var chart = chartFunction();
chart.apply = function() {
@joshjordan
joshjordan / prompt_joshjordan_setup
Last active Jan 16, 2016
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
branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c${_prompt_joshjordan_colors[4]}●%f)"
else
branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c)"
View method-cache-test.rb
require 'benchmark'
module A
end
class DefinedMethodStyle
def dont_bust_cache(*)
Object.new
nil
end
You can’t perform that action at this time.