I hereby claim:
- I am j3rn on github.
- I am j3rn (https://keybase.io/j3rn) on keybase.
- I have a public key ASBhifQXfnaOXVcs8wkePXEhYqHf5sX7-XkL_U5IX_CALwo
To claim this, I am signing this object:
ain't | |
aren't | |
can't | |
could've | |
couldn't | |
couldn't've | |
didn't | |
doesn't | |
don't | |
hadn't |
#!/usr/bin/env python | |
import RPi.GPIO as GPIO | |
from time import * | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(18, GPIO.OUT) | |
GPIO.setup(12, GPIO.OUT) | |
GPIO.setup(13, GPIO.OUT) |
#!/bin/sh | |
GIT_REPO=$HOME/portfolio.git | |
TMP_GIT_CLONE=$HOME/tmp_portfolio | |
PUBLIC_WWW=$HOME/www | |
touch $HOME/deploy | |
git clone $GIT_REPO $TMP_GIT_CLONE | |
cp -rv $TMP_GIT_CLONE/* $PUBLIC_WWW | |
rm -rf $TMP_GIT_CLONE |
I hereby claim:
To claim this, I am signing this object:
class Parser | |
ENCLOSURES = { | |
'"' => '"', | |
'(' => ')', | |
'{' => '}', | |
'[' => ']' | |
} | |
def initialize | |
@i = 0 |
# USAGE: ruby proc_fix.rb <one or more space-separated model names without path or extension> | |
# e.g. ruby proc_fix.rb activity | |
# e.g. ruby proc_fix.rb accessory bill_charge | |
# **Must be run in Rail's root** | |
# What it do: Converts all "Proc.new { |foo|" to "(foo) -> {" | |
before = /scope(.*)Proc\.new\s*\{\s*\|(.*)\|/ | |
after = 'scope\1->(\2) {' | |
ARGV.each do |modelname| |
# This script has been tested with zsh 5.2 on macOS 10.12.3 with BSD sed and find. | |
# It may work under other conditions, but likely does not. | |
# old2new, the Ruby hash syntax updating function | |
# Takes the given files and replaces all instances of `:key => value` with the equivalent `key: value` | |
# Usage: old2new <path> | |
# NOTE: <path> can be a file or directory | |
function old2new() { | |
find $argv \( -name "*.haml" -or -name "*.rb" -or -name "*.erb" \) -exec sed -E -i '' 's/:([A-z]+) =>/\1:/g' '{}' \; | |
} |
#!/bin/bash | |
# Usage: ./backup.sh <path to directory to archive> <GPG user> | |
tar -C $1 -c . | gpg --recipient $2 -e > $(date -Iminutes | tr -d ':').tar.gz.gpg |
pattern = %{foo: "bar", bar: %{baz: "qux"}} | |
good_data = %{foo: "bar", bar: %{baz: "qux", qux: "asdf"}} | |
bad_data = %{foo: "baz", bar: %{baz: "asdf"}} | |
### This is perfect | |
match?(%{foo: "bar", bar: %{baz: "qux"}}, good_data) | |
#=> true | |
match?(%{foo: "bar", bar: %{baz: "qux"}}, bad_data) | |
#=> false |
# Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', | |
'deploy:push', | |
'deploy:migrate', | |
'deploy:restart'] | |
task :deploy_production => ['deploy:set_production_app', | |
'deploy:push', | |
'deploy:migrate', | |
'deploy:post_deploy', | |
'deploy:restart'] |