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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" /> | |
| <title></title> | |
| <meta http-equiv="Content-Type" | |
| content="text/html; charset=us-ascii" /> | |
| <link href="main.css" rel="stylesheet" type="text/css" /> | |
| <!--[if lte IE 6]> |
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
| test1 = [1,2,3] | |
| test2 = [2,3,4,5,6,7,8] | |
| unknown, known = *[test1 - test2, test1 & test2] | |
| #=> [[1],[2,3]] |
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 self.generate_planned_simulation(model_package_id, start_date, finish_date, increment) | |
| start_date = Date.strptime(start_date,'%B %d, %Y') | |
| finish_date = Date.strptime(finish_date, '%B %d, %Y') | |
| dates = get_dates_with_interval(start_date, finish_date, increment) | |
| activities = Activity.all( | |
| :conditions => [ | |
| '(start_date <= :finish_date OR finish_date <= :finish_date) AND model_package_id = :model_package_id', | |
| { :finish_date => finish_date, :model_package_id => model_package_id } | |
| ], |
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
| [:last, :this, :next].each do |week| | |
| define_method("#{week}_week") { schedule(week) } | |
| end | |
| def schedule(week) | |
| @schedule ||= YAML.load_file('schedule.yml')["schedule"] | |
| @schedule.select {|d| date_range(week.to_sym).include?(d)} | |
| end | |
| def date_range(week) |
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 Model < ParentModel | |
| include Foo::Bar | |
| extend Bar::Baz | |
| acts_as_authentic | |
| dsl_specific_flags | |
| module InternalModule | |
| ... | |
| 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
| namespace :routes do | |
| desc 'print list of routes' | |
| task :list => [:environment] do | |
| Rails.application.routes.routes.map do |route| | |
| p "#{route.requirements[:controller]} #{route.requirements[:action]} #{route.verb}" | |
| 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
| FactoryGirl.define do | |
| factory :contact do | |
| name 'Nigel Weiner' | |
| factory :admin_contact do | |
| admin true | |
| 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
| class Letterpress | |
| def self.run(board) | |
| all_words = File.open('/usr/share/dict/words').readlines.map! { |line| line.strip.chomp } | |
| valid_words = all_words.select { |w| w =~ /[^#{board.join}]/ } | |
| valid_words = valid_words.select do |w| | |
| bool = true | |
| bool = false if w.size <= 2 | |
| split_word = w.downcase.split('') |
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
| # app/controllers/api/v1/users_controller.rb | |
| class Api::V1::UsersController | |
| def index | |
| render json: { path: 'v1/users#index' } | |
| end | |
| def show | |
| render json: { path: 'v1/users#show' } | |
| 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
| fn main() { | |
| for int::range(1, 101) |num| { | |
| let mut answer; | |
| if is_fifteen(num){ | |
| answer = "FizzBuzz"; } | |
| else if is_three(num) { | |
| answer = "Fizz"; | |
| } | |
| else if is_five(num) { | |
| answer = "Buzz"; } |
OlderNewer