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
find . -name "*.[mh]" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done | |
find . -name "*.[mh]" | while read line; do git stripspace < $line > $line.new; mv $line.new $line; done |
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
drop table if exists target_homes; | |
with | |
supermarket_zones as (select st_expand(geom, 0.0045) as zone, 5 as score from osm_polygons where osm_polygons.shop='supermarket'), | |
rail_stop_zones as (select st_expand(geom, 0.0045) as zone, 5 as score from trimet_rail_stops), | |
park_zones as (select st_expand(geom, 0.0045) as zone, 2 as score from osm_polygons where osm_polygons.leisure='park'), | |
target_buildings as ( | |
select * from supermarket_zones inner join buildings on st_intersects(supermarket_zones.zone, buildings.geom) where buildings.subarea='City of Portland' | |
union select * from rail_stop_zones inner join buildings on st_intersects(rail_stop_zones.zone, buildings.geom) where buildings.subarea='City of Portland' | |
) |
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
TEXT = <<EOF | |
See, the interesting thing about this text | |
is that while it seems like the first line defines an indent | |
it's actually the last line which has the smallest indent | |
there are also some blank lines | |
both with and without extra spaces in them | |
and it just goes on and on |
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_DATA = {} | |
BUNDLED_GEMS = `bundle show | grep "*" | awk '{print $2}'`.split("\n").sort | |
require 'bigdecimal' | |
def require(name) | |
start = Time.now | |
ret = super | |
stop = Time.now | |
total = BigDecimal(stop-start, 6) | |
REQUIRE_DATA[name] = total if BUNDLED_GEMS.include?(name) |
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
export PROMPT_COMMAND='prompt_status=$?' | |
export PS1='$(if [[ $prompt_status == 0 ]]; then echo "¯\_(ツ)_/¯"; else echo "ᕕ( ᐛ )ᕗ"; fi) 🐈 $' |
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
class ArticlesController < ApplicationController | |
def create | |
PublishArticle.publish(current_user, params[:article]) do |result| | |
result.success { |article| redirect_to article_path(article) } | |
result.failure { |article| @article = article; render :new } | |
end | |
end | |
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 'spork' | |
Spork.prefork do | |
require 'rspec' | |
require 'pry' | |
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | |
RSpec.configure do |config| | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
config.run_all_when_everything_filtered = true |
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
git status --porcelain | grep 'test' | grep -v 'factories' | cut -c4- | sort | uniq | xargs zeus test |
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
#!/usr/bin/env ruby | |
if name = ARGV.first | |
path = `gem which #{name}` | |
readme = Dir.glob(File.join(File.dirname(path), "../", "README.{md,markdown}")).first | |
fail "Failed to find readme for gem '#{name}'" unless File.exist?(readme) | |
puts File.read(readme) | |
else | |
puts "Usage: gem-man gem_name" | |
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 'childprocess' | |
guard 'shell' do | |
watch %r{^app/(.+)\.rb$} do |m| | |
`killall rake` | |
# Why this: | |
# - spawn a child process to avoid locking Guard | |
# - make sure that the child process has stdout and stdin otherwise it crashes | |
# - bonus point: get REPL access in the simulator! |
OlderNewer