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
| <html> | |
| <head> | |
| <style> | |
| #my-div | |
| { | |
| width : 534px; | |
| height : 850px; | |
| overflow : hidden; | |
| position : relative; | |
| } |
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
| function indent() { | |
| depth=$1 | |
| spacer=${2:" "} | |
| for ((i=0;i<$depth;i++)); do | |
| echo -ne " "; | |
| done | |
| } | |
| function recurse() { | |
| local name=$1 |
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 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 | |
| """ |
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
| 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 |
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
| # 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 |
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
| after_build do |q| | |
| 2.times { q.answers.build(FactoryGirl.attributes_for(:answer)) } | |
| 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
| survey { Survey.create(:name => "Survey Answer") } |
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 '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' |
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
| 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' |
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
| # 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