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
# This file is in lib | |
module AutoStripTextAttributes | |
extend ActiveSupport::Concern | |
included do | |
text_columns = columns.collect do |c| | |
c.name.to_sym if c.type == :string || c.type == :text | |
end.compact |
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
# NOTE if you want to do this outside a git repo, find . -type f can by substituted for git grep -l 'Factory' | |
# fix Factory.create and Factory() | |
$ git grep -l 'Factory' | xargs perl -pi -e 's/Factory(\.create)?\((\:)?(\w+)(, )?/FactoryGirl\.create\($2$3$4/g' | |
# fix Factory.build | |
$ git grep -l 'Factory' | xargs perl -pi -e 's/Factory\.build\((\:)?(\w+)(, )?/FactoryGirl\.build\($1$2$3/g' | |
# fix Factory.define | |
# NOTE after running this, at the very least you still have to wrap your definitions sets with a FactoryGirl.define do end block, |
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
-# adapted from https://github.com/ryanb/nifty-generators/blob/master/lib/generators/nifty/layout/templates/layout.html.haml | |
!!! | |
%html | |
%head | |
%title | |
= content_for?(:title) ? yield(:title) : "Untitled" | |
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ | |
= stylesheet_link_tag "nifty" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title> | |
<%= stylesheet_link_tag "application" %> | |
<%= javascript_include_tag "application" %> | |
<%= csrf_meta_tag %> | |
<%= yield(:head) %> | |
</head> | |
<body> |
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
html, body { | |
background-color: #4B7399; | |
font-family: Verdana, Helvetica, Arial; | |
font-size: 14px; | |
} | |
a img { | |
border: none; | |
} |
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
## in features/support/selectors.rb | |
when /^the (?<type>\w+){1} "(?<name>[^"]*){1}"$/ | |
[:xpath, "//li[contains(@class, '#{$~[:type]}') and contains(., '#{$~[:name]}')]"] | |
## in features/step_definitions/drag_things_steps.rb | |
def find_by_selector(thing) | |
selector = selector_for(thing) | |
find(selector[0], selector[1]) |
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
# in features/support/env.rb | |
After do |scenario| | |
# if scenario failed, open page in browser | |
if ENV["SAVE_AND_OPEN_PAGE"] == "true" && scenario.failed? | |
save_and_open_page | |
end | |
end |
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
NPR = {}; | |
NPR.base64 = {}; | |
// Code below belongs to NPR | |
NPR.base64.PADCHAR = '='; | |
NPR.base64.ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
NPR.base64.makeDOMException = function () { | |
var e, tmp; | |
try { |
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 | |
# load our gem | |
require 'barometer' | |
if ARGV.size == 0 | |
puts "Usage: get_temp.rb PLACE_NAME" | |
exit 0 | |
end | |
# make request |
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
# encoding: utf-8 | |
require 'wombat' | |
SIGNS = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", | |
"Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"] | |
data = Wombat.crawl do | |
base_url "http://www.taosnet.com" | |
path "/starwatcher/rdoscrpt.html" |