So I thought I was being clever, writing my Rails controller actions like this:
def create
set_post_from_post_id
set_comment_as_new
respond_to do |format|
comment.save| # PHI - Some greek number | |
| PHI = Rational(610,377).to_f | |
| # Negative inverse of PHI | |
| I_PHI = -Rational(1, PHI).to_f | |
| # Square root of 5 | |
| SQRT_5 = 5 ** 0.5 | |
| # Fibonacci value for given number x |
| [diff] | |
| tool = diff | |
| algorythm = minimal | |
| [color] | |
| branch = auto | |
| diff = auto | |
| status = auto | |
| interactive = auto | |
| ui = true | |
| pager = true |
| Rehearsal ------------------------------------------------- | |
| with freez 1.490000 0.010000 1.500000 ( 1.493176) | |
| with constant 1.500000 0.000000 1.500000 ( 1.499597) | |
| with new 2.060000 0.000000 2.060000 ( 2.064578) | |
| ---------------------------------------- total: 5.060000sec | |
| user system total real | |
| with freez 1.470000 0.000000 1.470000 ( 1.480206) | |
| with constant 1.500000 0.000000 1.500000 ( 1.510912) | |
| with new 2.030000 0.000000 2.030000 ( 2.038113) |
| module NamespaceableController | |
| extend ActiveSupport::Concern | |
| included do | |
| helper_method :namespace | |
| end | |
| private |
| require 'benchmark' | |
| TIMES = 1000000 | |
| STRING = "this is a long and bad-ass string" | |
| Benchmark.bmbm do |test| | |
| test.report("Index") do | |
| TIMES.times { STRING.index("this is") } |
| def should_nest_multiple_conditionals? | |
| x = rand(10).to_i | |
| if Time.now.strftime("%A") != "Friday" | |
| if current_client.is_large_faceless_conglomerate? | |
| return true | |
| elsif Time.now.strftime("%A") == "Friday" | |
| return true | |
| end | |
| elsif LocalWeather.new("Edinburgh").sunny? |
| require 'time' | |
| require 'date' | |
| class Invitee | |
| end | |
| class Event | |
| attr_accessor :name | |
| attr_accessor :date | |
| attr_accessor :starts_at |
| #import <AddressBook/AddressBook.h> | |
| #import <Accounts/Accounts.h> | |
| #import <Social/Social.h> | |
| @interface ContactsDiscovery() | |
| @property (nonatomic, retain) ACAccountStore* accounts; | |
| @property (nonatomic, retain) ACAccountType* faceBookAccountType; | |
| @property (nonatomic, retain) ACAccount* faceBookAccount; | |
| @property (nonatomic, retain) id addressBook; | |
| @end |
| [diff] | |
| tool = diff | |
| algorythm = minimal | |
| [color] | |
| branch = auto | |
| diff = auto | |
| status = auto | |
| interactive = auto | |
| ui = true | |
| pager = true |