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 Lead | |
| @@filter_options = ["followup","skype", "documents", "estimate"] | |
| @@all_options = ["followup","skype", "documents", "won", "lost", "estimate"] | |
| validates :status, :inclusion => { :in => @@all_options} | |
| validates_presence_of :status, :name_project, :name_client, :url_project |
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 abs(x) | |
| (x < 0) ? -x : x | |
| end | |
| def sqrtIter(guess, x) | |
| isGoodEnough(guess,x) ? guess : sqrtIter( improve(guess,x) ,x) | |
| end | |
| def isGoodEnough(guess,x) |
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
| source :rubygems | |
| gem 'levenshtein-ffi', :require => 'levenshtein' | |
| gem "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
| # | |
| # Intro to Higher Order Functions | |
| # | |
| # translated to Ruby from Martin Scala Coursera.org class | |
| # | |
| def cube(n) | |
| n ** n | |
| 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 'rr' | |
| class CrazyMath | |
| def self.fib(n) | |
| if n < 3 | |
| 1 | |
| else | |
| CrazyMath.fib(n - 1) + CrazyMath.fib(n - 2) | |
| 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 MotionModel | |
| module Model | |
| def save(*) | |
| puts "called MM#save" | |
| end | |
| end | |
| end | |
| module MotionModel | |
| module Paranoid |
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
| #################### | |
| # Multi App Dynos | |
| #################### | |
| Recently @hirodusk tweeted - http://cl.ly/image/2s1X0E351v29 - about a prototype they've been working on to bring visibility to their dynos idling behavior. He got me thinking. | |
| What about if we can have a different Dyno that can be share between apps? So far, I've been able to acomplish something similar to this by having a bunch of different sinatra apps and mapping them to different URLS. All this under the same Git repo and Heroku app. This approach is all good if all the sinatra apps are related somehow, but it brakes if they apps are unrelated because you don't want them all in the same repository. | |
| I would love to pay Heroku for 5 Dynos and have them serve 10 different apps. |
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
| ----------------------------------------------------------------------------------------------------------------------- | |
| Michael Feathers wrote on Ruby Parley: | |
| I still like Bertrand Meyer's advice on exceptions: use them when you | |
| can't tell before a call whether it will succeed or not. | |
| That said, there are alternatives. You can pass two actions to a | |
| method, one of which is called when it succeeds and the other when it |
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
| ######################## | |
| me: | |
| ######################## | |
| Hi! This is Ivan. One of the founders of MealsApp.com I noticed you have recorded a lot of meals and I am wondering: - What don't you like and what do you like about the app? - What would you like to see in the app so that it is awesome? Thank you very very very very much for replying to this email. It'll help us create the best app for nutrition. Bon Appetit | |
| ######################## |