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
def set_content | |
case self.content_type | |
when "video/mpeg", "video/quicktime", "video/x-msvideo", 'video/x-ms-wmv', 'video/mp4', 'video/avi' | |
self.content = VIDEO | |
when 'image/gif', 'image/jpeg', 'image/png', "image/pjpeg", "image/x-png" | |
self.content = IMAGE | |
when 'audio/wav', 'audio/x-wav', 'audio/x-ms-wma', 'audio/mpeg', 'audio/x-m4a', 'audio/m4a' | |
self.content = AUDIO | |
when "application/msword", 'application/pdf', 'application/rtf', 'text/plain', 'text/rtf' | |
self.content = DOCUMENT |
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
# Then /^"([^\"]*)" should be in the autocomplete menu$/ do |name| | |
# xpath_to_auto_complete_selection = "//ul[contains(@class, 'ui-autocomplete')]" | |
# | |
# # wait until auto complete menu appears | |
# page.should have_xpath(xpath_to_auto_complete_selection) | |
# page.evaluate_script('$("#show_title").attr("value", "my p")') | |
# page.evaluate_script('e = jQuery.Event("keydown")') | |
# page.evaluate_script('e.which = 67') | |
# page.evaluate_script('$("#show_title").trigger("focus").trigger(e)') | |
# |
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
Failing Scenarios: | |
cucumber features/award/applying.feature:12 # Scenario: Applying for an award with no questions | |
cucumber features/award/applying.feature:23 # Scenario: Applying for an award with questions | |
cucumber features/award/applying.feature:47 # Scenario: Applying for my second award | |
cucumber features/award/applying.feature:82 # Scenario: A volunteer is nominates which organisation should validate the award before, during and after submission. | |
cucumber features/organiser/upload_photo.feature:3 # Scenario: Uploading a photo as organiser | |
cucumber features/schools/school_adviser/managing_schools.feature:23 # Scenario: Creating a school | |
cucumber features/volunteer/edit_my_profile.feature:29 # Scenario: Editing my interests | |
cucumber features/volunteer/photo_uploads.feature:65 # Scenario: Uploading an image and seeing it in the activity stream |
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
To remove vendor and public directories in textmate project (if it is loading too slow). | |
Click [i] in the tray, and edit the root folder pattern to this: | |
!.*/(\.[^/]*|public|vendor|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$ |
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
if CruiseControl::invoke_rake_task 'spec' | |
puts "Pushing on heroku... [Start]" | |
`git push heroku master` | |
puts "Pushed on heroku. [Done]" | |
puts "Running migrations... [Start]" | |
`heroku rake db:migrate` | |
puts "Migrated... [Done]" | |
puts "Prepare test db... [Start]" | |
`heroku rake db:test:prepare` | |
puts "Test database ready [Done]" |
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
Factory.define :user_credit_card do |cc| | |
cc.card_type "bogus" | |
cc.card_number 1 | |
cc.verification_value "123" | |
cc.expiration_date Time.now + 1.year | |
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
module Mergeable | |
def merge_associated_records_and_destroy(throwaway_object, special_cases = {}) | |
#look for any fields that match field name | |
field_name_to_update = "#{self.class.to_s.downcase}_id" | |
Dir[Rails.root.to_s + '/app/models/**/*.rb'].each { |file| require(file)} | |
message = [] | |
models = ActiveRecord::Base.subclasses.collect | |
begin | |
models.each do |m| | |
if m.columns_hash["#{self.class.to_s.downcase}_id"] |
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
!!! 5 | |
%html | |
%head | |
%title= "Your Website" | |
%meta{ :content => "", :name => "description" } | |
%meta{ :content => "", :name => "author" } | |
%meta{ :content => "3 days", :name => "revisit-after" } | |
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" } | |
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" } | |
%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
function remove_selected_from_options(arr1, arr2) { | |
var filtered_options = []; | |
for (var i=0; i < arr1.length; i++) { | |
var included = false; | |
for (var z=0; z < arr2.length; z++) { | |
if (arr2[z][0] == arr1[i][0]) { | |
included = true; | |
break; | |
} | |
} |
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
mkdir rails-5-test-app | |
cd rails-5-test-app | |
touch .ruby-version | |
echo 'ruby-2.2.2' > .ruby-version | |
touch Gemfile | |
printf "source 'https://rubygems.org'\nruby '2.2.2'\n\n\ngem 'rails', github: 'rails/rails'\ngem 'arel', github: 'rails/arel'\ngem 'rack', github: 'rack/rack'" >> Gemfile | |
bundle | |
bundle exec rails new . --dev --force | |
bundle exec rails s |
OlderNewer