This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
class NoNilSet | |
include Enumerable | |
def initialize(values=[]) | |
@set = Set.new | |
@set += Array(values).compact | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
module Rust | |
module Uuid | |
extend FFI::Library | |
ffi_lib './librust_uuid-2b1863329f7b31d9-0.1.so' | |
attach_function :asdf, [], :string | |
attach_function :uuid_str, [], :void | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\copy ( | |
select | |
name, | |
unit_price | |
from | |
widgets | |
) to 'widgets.csv' with (FORMAT CSV, force_quote *, header); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- $> PGTZ=PST8PDT psql | |
-- If the PGTZ environment variable is set in the frontend environment | |
-- of a client based on libpq, libpq will automatically SET TIMEZONE to | |
-- the value of PGTZ during connection start-up. | |
select | |
created_at, | |
created_at at time zone 'UTC' at_tz_utc, | |
created_at at time zone 'PST' at_tz_pst, | |
created_at at time zone 'PST' - interval '8 hours' at_tz_pst_minus_8_hours |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> ag FOO some_file | awk 'split($0, a, "\"") { print $2, $3 }' | |
FOO_WIDGET_COUNT=1 | |
FOO_WIDGET_NAME="Black Jack Johnson" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this is a very simple, work in progress helper method for stubbing the stripe checkout.js | |
#this creates a fake server that will generate stripe token as if it's coming from stripe. So we can test credit card input | |
class FakeStripe < Sinatra::Base | |
def self.boot | |
instance = new | |
Capybara::Server.new(instance).tap { |server| server.boot } | |
end | |
get '/checkout.js' do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rake' | |
gem 'lotus-router' | |
gem 'lotus-controller' | |
gem 'lotus-view' | |
group :test do | |
gem 'rspec' | |
gem 'capybara' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This tool is used to compare microbenchmarks across two versions of code. It's | |
paranoid about nulling out timing error, so the numbers should be meaningful. | |
It runs the benchmarks many times, scaling the iterations up if the benchmark | |
is extremely short, and it nulls out its own timing overhead while doing so. It | |
reports results graphically with a text interface in the terminal. | |
You first run it with --record, which generates a JSON dotfile with runtimes | |
for each of your benchmarks. Then you change the code and run again with | |
--compare, which re-runs and generates comparison plots between your recorded | |
and current times. In the example output, I did a --record on the master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef tmuxinator mux | |
# zsh completion for tmuxinator | |
# Install: | |
# $ mkdir -p ~/.tmuxinator/completion | |
# $ cp _tmuxinator ~/.tmuxinator/completion | |
# $ vi ~/.zshrc # add the following codes | |
# fpath=($HOME/.tmuxinator/completion ${fpath}) | |
# autoload -U compinit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Cisco Anyconnect CSD wrapper for OpenConnect | |
CSTUB="$HOME/.cisco/hostscan/bin/cstub" | |
$ARCH=$(uname -m) | |
if [[ "$ARCH" == "x86_64" ]] | |
then |