This file contains 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
Sub autofilter_split() | |
Rows("1:1").Select | |
' Turn on Autofilter | |
Selection.AutoFilter | |
Rows("2:2").Select | |
' Freeze Panes | |
ActiveWindow.FreezePanes = True | |
End Sub |
This file contains 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
Thread.abort_on_exception = true | |
require 'bundler/setup' | |
require 'thread/pool' | |
require 'csv' | |
require 'shopify_api' | |
pool = Thread.pool 2 | |
mutex = Mutex.new | |
# ActiveResource::Base.logger = Logger.new($stderr) | |
# ActiveResource::Base.logger.level = Logger::DEBUG |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am seamusabshere on github. | |
* I am seamusabshere (https://keybase.io/seamusabshere) on keybase. | |
* I have a public key whose fingerprint is 00E8 B10F 062A 1672 DF80 F69A 6417 28F0 0400 349E | |
To claim this, I am signing this object: |
This file contains 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
# requires the zaru gem, just get it :) | |
require 'tmpdir' | |
require 'zaru' | |
def tmp_path(name_hint = nil) | |
name_hint ||= 'tmp' | |
extname = File.extname name_hint | |
name_hint = Zaru.sanitize! File.basename(name_hint, extname).to_s.gsub(/\s+/, '_') | |
path = Dir::Tmpname.create(name_hint) {} |
This file contains 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 | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' | |
green='\033[0;32m' |
This file contains 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
#!/usr/bin/env ruby | |
# USAGE gg "hello world" "hola mundo" | |
# * requirements: gem install posix-spawn, sudo port install coreutils (gsed) | |
# * changes file names and file contents (in the right order!) | |
# * limited regex support - it has to work with `system 'gsed', '--in-place', '-e', "s%#{search}%#{replace}%g", path` | |
require 'posix/spawn' | |
require 'fileutils' | |
force = ENV['FORCE'] == 'true' |
This file contains 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
-- SELECT Faraday_JoyDivision('households'::text, 'year_built'::text) AS the_geom | |
explain analyze WITH | |
-- Snap the disparate points to a regular grid where theres data for the given filter | |
grid AS ( | |
SELECT | |
-- note transform here | |
ST_SnapToGrid(ST_Transform(the_geom, 4326), 0.002) the_geom, | |
year_built |
This file contains 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
MISSING = %w{ N/A n/a NULL null - #DIV/0 #REF! #NAME? NIL nil NA na #VALUE! #NULL! NaN #N/A #NUM! ? } |
This file contains 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
#!/usr/bin/env ruby | |
# Usage: hcsv DBNAME TBLNAME HSTORECOL | |
# Output columns will be id + all the hstore keys | |
dbname, tblname, hstorecol = ARGV[0..2] | |
# Get hstore keys | |
out = `psql #{dbname} --tuples --command "SELECT DISTINCT k FROM (SELECT skeys(#{hstorecol}) AS k FROM #{tblname}) AS dt ORDER BY k"` | |
headers = out.split(/\n/).map(&:strip) |
This file contains 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/bash | |
set -x | |
read -p "Replace contents? (y/n) " RESP | |
if [ "$RESP" = "y" ]; then | |
ack --print0 -l "$1" | xargs -0 -n 1 gsed --in-place="" -e "s%$1%$2%g" | |
fi | |
read -p "Replace in filenames? (y/n) " RESP | |
if [ "$RESP" = "y" ]; then | |
find . -print0 -not -path "*.git*" -a -name "*$1*" | xargs -0 -n 1 mmv "s/$1/$2/" | |
fi |
NewerOlder