Skip to content

Instantly share code, notes, and snippets.

View ddd1600's full-sized avatar

David Douglas ddd1600

  • Murrells Inlet, SC
View GitHub Profile
@ddd1600
ddd1600 / tairu_launch.rb
Created December 26, 2014 21:50
tairu configuration & launch
layers = {
'geo' => {
'provider' => 'mbtiles',
'tileset' => 'NorthCharleston.mbtiles',
'location' => '~/Documents/MapBox/export',
'format' => 'png'
}
}
cache = {
class ScrapeFfiec
attr_reader :b
def initialize
@year = Time.now.year
@b = Watir::Browser.new
@county_fips = []
end
@ddd1600
ddd1600 / short_loi.rb
Created November 30, 2014 23:39
short_loi.rb
string = <<-eos
LETTER OF INTENT
#{Time.now.month} #{Time.now.day}, #{Time.now.year}
#{recipient_first_name+” “+recipient_last_name}
#{recipient_name_pt2}
#{recipient_address}
@ddd1600
ddd1600 / gist:dd9a738eb6b3d7fcbedf
Created June 4, 2014 14:42
textmate snippets auto backup script
#!/bin/sh
echo 'about to do an automatic backup of textmate snippets'
cd /Users/daviddouglas/Library/Application\ Support/Avian/Bundles
git add -A
git commit -m 'automated update'
git push origin master
echo 'automated textmate snippets backup complete.'
<text top="614" left="247" width="176" height="14" font="234">6312-6309 N. Ocean Blvd.</text>
<text top="632" left="247" width="176" height="14" font="234">6300-6302 N. Ocean Blvd.</text>
<text top="651" left="247" width="176" height="14" font="234">6206-6300 N. Ocean Blvd.</text>
<text top="669" left="247" width="176" height="14" font="234">6108-6200 N. Ocean Blvd.</text>
<text top="669" left="610" width="10" height="14" font="0">Y</text>
<text top="688" left="247" width="176" height="14" font="234">6100-6108 N. Ocean Blvd.</text>
<text top="706" left="247" width="176" height="14" font="234">6000-6100 N. Ocean Blvd.</text>
<text top="725" left="247" width="176" height="14" font="234">5910-6000 N. Ocean Blvd.</text>
<text top="743" left="247" width="176" height="14" font="234">5906-5908 N. Ocean Blvd.</text>
<text top="762" left="247" width="139" height="14" font="243">59th Ave. N., St. End</text>
[{:county=>"Greenville", :zone_short=>"CAMPO", :zone_long=>"CAMPOBELLO"}, {:county=>"Greenville", :zone_short=>"EASTG", :zone_long=>"EASTATOE GAP"}, {:county=>"Greenville", :zone_short=>"DACUS", :zone_long=>"DACUSVILLE"}, {:county=>"Greenville", :zone_short=>"BREVA", :zone_long=>"BREVARD"}, {:county=>"Greenville", :zone_short=>"PELHA", :zone_long=>"PELHAM"}, {:county=>"Greenville", :zone_short=>"SLATE", :zone_long=>"SLATER"}, {:county=>"Greenville", :zone_short=>"PELZE", :zone_long=>"PELZER"}, {:county=>"Greenville", :zone_short=>"PARIM", :zone_long=>"PARIS MOUNTAIN"}, {:county=>"Greenville", :zone_short=>"STANM", :zone_long=>"STANDINGSTONE MTN"}, {:county=>"Greenville", :zone_short=>"HICKT", :zone_long=>"HICKORY TAVERN"}, {:county=>"Greenville", :zone_short=>"FORKS", :zone_long=>"FORK SHOALS"}, {:county=>"Greenville", :zone_short=>"SIMPS", :zone_long=>"SIMPSONVILLE"}, {:county=>"Greenville", :zone_short=>"TAYLO", :zone_long=>"TAYLORS"}, {:county=>"Greenville", :zone_short=>"LANDR", :zone_long=>"LANDRUM"}, {:
@ddd1600
ddd1600 / .bash_profile
Created November 2, 2013 21:41
as of Nov2,2013--loads gdal, postgis, postgresql stuff I think, mate, and some others
export PGHOST=localhost
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
export PATH=/usr/local/bin:/usr/local/pgsql-9.3/bin:/Library/Frameworks/GDAL.framework/Versions/1.10/Programs/:$PATH
export $CENSUS_API_KEY='cf776dbf36ebccca30d13c18efc844ae341361a1'
require 'highline/import'
require 'open-uri'
##UNIX CALLS (FROM RAILS CONSOLE)
def open
`open .`
end
def mate
@ddd1600
ddd1600 / a.rb
Created October 18, 2013 20:26
'export geojson' textmate snippet, triggered by 'geojson[tab]'
def nonspatials
cols = self.class.columns.select{|c| c.type != :spatial}.map(&:name).sort
attributes.slice(*cols)
end
def self.export_geojson(fn, records, criteria_only=false)
features = []
f = RGeo::GeoJSON::EntityFactory.new
ActiveRecord::Base.silence do
records.each_with_index do |r, i|
@ddd1600
ddd1600 / a.rb
Created October 18, 2013 00:07
PostGIS spatial column index creation, migration for rails, for creating index when getting 'ActiveRecord::StatementInvalid: PG::ProgramLimitExceeded: ERROR: index row requires...' type error
ActiveRecord::StatementInvalid: PG::ProgramLimitExceeded: ERROR: index row requires