Skip to content

Instantly share code, notes, and snippets.

Michael Kirk michaelkirk

Block or report user

Report or block michaelkirk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@michaelkirk
michaelkirk / application.css
Last active Aug 29, 2015
railsgirls demo app
View application.css
body { padding-top: 100px; }
footer { margin-top: 100px; }
table, td, th { vertical-align: middle; border: none; }
th { border-bottom: 1px solid #DDD; }
@michaelkirk
michaelkirk / mkirk-pubkey.asc
Created Jun 27, 2014
mkirk's public GPG key
View mkirk-pubkey.asc
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.13 (Darwin)
mQENBFICeeoBCADAaV2yoK4kNUWm83PwoHv1GSPaWK1H03Zp5vauJvy2Wge+A08e
S3wXH4jCBV7s1AQDP+wW9FsAU4w/UIctAFFH7DrHdNuEVfi2GNLf6BMQll0LbW83
Gssw34Tffnogf/DttrN46t4Zoa0wI9BVZaUqYsp+seGLJ48/imykUBgXxXc8P05d
bFvC0TMgMRWvR3R33Os3eNPq/6GSID+cfluYRwc3DT9aMCMiFLUz9PEeJTxmCs7K
ObB0sJNakeMHefuYZaqrULLG5lD7h0dLXcU319MOQ2McEKb2Ry6w0hI9Dkk4uk8U
2xQUtEhhww9evxQtWIYELwPpN0DNRyPwjFwfABEBAAG0Kk1pY2hhZWwgS2lyayA8
bWljaGFlbC5qb2huLmtpcmtAZ21haWwuY29tPokBOAQTAQIAIgUCUgJ56gIbAwYL
@michaelkirk
michaelkirk / some_scraping_job.py
Last active Aug 29, 2015
example of how I might parallelize something using fork in python
View some_scraping_job.py
#let's say there are 1,234 pages to scrape in total
last_page = 1234
#And the page numbering starts at "1"
first_page = 1
#This is the way to scrape every record in a single process
def scrape_all_pages():
scrape_page_range(first_page, last_page)
@michaelkirk
michaelkirk / start_fresh
Created Sep 2, 2014
Drop the existing database, and replace with only the seeded water fountain data.
View start_fresh
heroku pg:reset --remote production
echo "create extension postgis" | heroku pg:psql --remote production
heroku run rake db:schema:load --remote production
heroku run rake wetap:import_existing_data
View gist:948835
params = {"longitude":194.5432,"latitude":194.5432}
ct = CountThreshold.create!(params)
#was longitude assigned?
puts ct.longitude
# re populate ct from the DB based on it's ID to make sure the fields were persisted.
ct.reload
#was longitude persisted?
@michaelkirk
michaelkirk / gist:948842
Created Apr 29, 2011
ruby, dumb but true
View gist:948842
#this is dumb but true
irb(main):001:0> a = {:a => 1}
=> {:a=>1}
irb(main):002:0> a['a']
=> nil
irb(main):003:0> a[:a]
=> 1
View terrain.py
@before.harvest
def setup_test_database(variables):
# Setup the testing database
world.test_runner = django_nose.NoseTestSuiteRunner()
# Setup environment.
world.test_runner.setup_test_environment()
# Create Base DB
world.test_db = world.test_runner.setup_databases()
@before.harvest
@michaelkirk
michaelkirk / terrain.py
Created Mar 6, 2012
terrain.py for lettuce, using south
View terrain.py
from lettuce import after, before, world
from selenium import webdriver
from django.core.management import call_command
from django.test.simple import DjangoTestSuiteRunner
import lettuce_webdriver.webdriver
@before.harvest
def setup_test_database_and_env(variables):
# FIXME when path_for_test_db_setup is outside of this method,
# running ./manage.py test explodes
@michaelkirk
michaelkirk / unoptimize_to_xs_hack.rb
Created Apr 26, 2012
work around for rails 3 to_xs
View unoptimize_to_xs_hack.rb
# work around for https://github.com/rails/rails/pull/2076
class String
alias_method :to_xs, :original_xs
end
@michaelkirk
michaelkirk / .ackrc
Created Jun 5, 2012
get ack to search cucumbers
View .ackrc
--type-set=cucumber=.feature
--cucumber
You can’t perform that action at this time.