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 'csv' | |
| namespace :seed do | |
| desc "seed some awesomeness" | |
| task :awesomeness => :environment do | |
| CSV.foreach(File.join(Rails.root, 'lib/assets/yolo.csv')) do |row| | |
| Awesome.create(:attribute_a => row[0], :attribute_b => row[1]) | |
| 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
| Module.constants.select do |constant_name| | |
| constant = eval constant_name | |
| if not constant.nil? and constant.is_a? Class and constant.superclass == ActiveRecord::Base | |
| constant | |
| 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
| <%= form_for(@project) do |f| %> | |
| <% if f.errors.any? %> | |
| <div id='error_explanation'> | |
| <h2><%= pluralize(f.errors.count, 'error') %> | |
| prohibited this foo from being saved:</h2> | |
| <ul> | |
| <% f.errors.full_messages.each do |msg| %> | |
| <li><%= msg %></li> | |
| <% end %> | |
| </ul> |
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
| FactoryGirl.define do | |
| factory :user do | |
| first_name 'John Doe' | |
| last_name 'Doe' | |
| trait :yolo do | |
| first_name 'Spinder' | |
| last_name 'Man' | |
| end | |
| factory :spinder, traits: [:yolo] | |
| 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
| = resource.comments.each do |comment| | |
| %br | |
| = comment.text |
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
| $(document).ready -> | |
| $("#following_option").on "ajax:complete", (evn, data) -> | |
| $("#following_option").html(data.responseText) |
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 Conversation | |
| include Mongoid::Document | |
| include Mongoid::Timestamps | |
| has_and_belongs_to_many :participants, :class_name => 'User', inverse_of: :conversations | |
| embeds_many :messages, :class_name => 'Message' | |
| 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
| private | |
| def play_games | |
| Game.unscoped.where(:state => "active", :start_at.lt => Time.zone.now).each do |game| | |
| game.play | |
| 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
| $(document).ready -> | |
| mapOptions = | |
| center: new google.maps.LatLng(-34.397, 150.644) | |
| zoom: 8 | |
| mapTypeId: google.maps.MapTypeId.ROADMAP | |
| map = new google.maps.Map $("#venues_map_canvas").get(0), mapOptions |
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
| simple_form_for(@object) do |f| | |
| # this is an input for a name | |
| f.input :name | |
| # i want just an input for an autocompleter that has nothing to do with the @object | |
| f.input |