View iframe-position.html
<html> | |
<head> | |
<style> | |
#my-div | |
{ | |
width : 534px; | |
height : 850px; | |
overflow : hidden; | |
position : relative; | |
} |
View gist:903001
function indent() { | |
depth=$1 | |
spacer=${2:" "} | |
for ((i=0;i<$depth;i++)); do | |
echo -ne " "; | |
done | |
} | |
function recurse() { | |
local name=$1 |
View watch
#!/usr/bin/env python | |
""" | |
-Thanks to Shawn Milochik for this - saved for future reference | |
Run unit test suite every time a Python file | |
is modified. | |
Requires pyinotify: | |
https://github.com/seb-m/pyinotify | |
""" |
View gist:994244
def isAnagramOf(attempt, original): | |
# all the same case | |
attempt = attempt.strip() | |
if len(attempt) < 1: # only actual words | |
return False | |
attempt, original = attempt.lower(), original.lower() | |
for character in attempt: | |
position = original.find(character) | |
if (position == -1): | |
return False |
View gist:1224087
# Question model - question.rb | |
class Question < ActiveRecord::Base | |
attr_accessible :text, :survey_id | |
belongs_to :survey | |
validates_presence_of :text, :survey | |
end | |
#Survey model - survey.rb |
View gist:1224293
after_build do |q| | |
2.times { q.answers.build(FactoryGirl.attributes_for(:answer)) } | |
end |
View gist:1224294
survey { Survey.create(:name => "Survey Answer") } |
View spec_helper.rb
require 'rubygems' | |
require 'spork' | |
Spork.prefork do | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'capybara/rspec' |
View Gemfile
group :test, :development do | |
gem 'sqlite3' | |
gem 'rspec-rails', '~> 2.6.1' | |
#capybara > webrat: http://zadasnotes.blogspot.com/2011/08/migrating-from-webrat-to-capybara.html?utm_source=rubyweekly&utm_medium=email | |
gem "capybara", "~> 1.0.0" | |
#headless js testing that hopefully is faster than selenium | |
gem "capybara-webkit", "~> 0.6.1" | |
#supposedly you need this for Mac OS X file system scanning, though it's worked fine so far | |
gem "rb-fsevent", "~> 0.4.3.1" | |
# gem 'guard-rspec' |
View Guardfile
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard 'rspec', :version => 2, :cli => "--drb" do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec/" } | |
# Rails example | |
watch(%r{^spec/.+_spec\.rb$}) |
OlderNewer