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 Story | |
| attr_reader :forked_stories, :id | |
| class << self | |
| def get_id | |
| last_id = instance_variable_get("@last_id") | |
| next_id = last_id.nil? ? :a : last_id.to_s.succ.to_sym | |
| instance_variable_set("@last_id", next_id) | |
| # puts "XXX Returning #{next_id}" | |
| next_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
| module FakeActiveRecord | |
| class Errors < Hash | |
| alias_method :count, :size | |
| def full_messages | |
| map do |key, message| | |
| "#{message}" | |
| end | |
| 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
| #!/usr/bin/env ruby | |
| # Author: Bálint Érdi <[email protected]> | |
| # forking the work of László Bácsi <[email protected]> | |
| require 'rubygems' | |
| require 'httparty' | |
| require 'json' | |
| require 'sequel' |
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
| (defn to-binary | |
| ([number] | |
| (apply str (to-binary number []))) | |
| ([number digits] | |
| (if | |
| (or (= 0 number) (= 1 number)) (cons number digits) | |
| (recur (quot number 2) (cons (rem number 2) digits)))) | |
| ) |
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 ruby -w | |
| FILE_TYPES = ["rb", "feature", "yml", "erb", "haml"] | |
| def rm_trailing_whitespace!(file) | |
| trimmed = [] | |
| trimmed = File.readlines(file).map do |line| | |
| line.gsub(/\s+$/, "") | |
| end | |
| open(file, "w") { |f| f.write(trimmed) } | |
| 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
| require 'test/unit' | |
| class CodeLineCounter | |
| class << self | |
| def comment?(line, in_multiline_comment) | |
| line.strip! | |
| return [true, in_multiline_comment] if line.empty? | |
| if in_multiline_comment | |
| if line =~ /\*\/(.*)/ | |
| comment?($1, 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
| require 'test/unit' | |
| class Dependencies | |
| def initialize | |
| @deps = Hash.new([]) | |
| end | |
| def add_direct(klass, dep_klasses) | |
| @deps[klass] = dep_klasses |
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
| Factory.define :reset_password do |reset_pw| | |
| reset_pw.reset_code "d1b9547cb3ec99180acfe951c807ec567c8b9252" | |
| reset_pw.association(:user) | |
| end | |
| Factory.define :user do |user| | |
| user.login { Factory.next(:login) } | |
| user.email { Factory.next(:email) } | |
| user.first_name 'Balint' | |
| user.last_name 'Erdi' |
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
| Feature: Edit user settings | |
| In order to save a ton of time | |
| As a Teambox admin | |
| I want users to edit their own settings |
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
| set :deploy_to, "path_to_teambox_on_production_server" | |
| set :rails_root, deploy_to + "/current" | |
| after "deploy:update_crontab" | |
| namespace :deploy do | |
| desc "Update the crontab file" | |
| task :update_crontab, :roles => :db do | |
| run "cd #{rails_root} && whenever --update-crontab #{application}" | |
| end |