- In order to understand recursion, one must first understand recursion
- Any fool can write code that a computer can understand. Good programmers write code that humans can understand - Martin Fowler
- Programming is about learning something new every day -Simone Carletti
- Code never lies, comments do. - Alexander Dvorkovyy
- Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live - Rick Osborne or John Woo
- Don't worry about the wasted effort unless you know - by measurement - that the waste is noticeable and important. Always favor the clean code you need over than the fast code you might need. - Brian Marick
- So why was it so hard to tell a computer to do something only mildly complex? Well, it wasn't the "mildly complex" part that was giving me problems; it was the "tell a computer" part. - Chris Pine
- Java is to JavaScript what Car is to Carpet - Chris Heilmann
- A good programmer is someone who looks both ways before crossing a one-way street - ?
- Programming isn't about what you know; it's about what you can figure out. As long as you know where to find out the things you forgot, your doing just fine - Chris Pine
- Debugging is like farting - it's not so bad when it's your own code - Paul Downey
- I don't care if it works on your machine! We are not shipping your machine! - Ovidiu Platon
- You wanted a banana but what you got was a gorilla holding the banana and the entire jungle - Joe Armstrong
- Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away - Antoine de Saint Exupéry
- When I am working on a problem I never think about beauty. I only think about how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong - Buckminster Fuller
- There are only two hard problems in Computer Science: cache invalidation and naming things - Phil Karlton
- There is No code that is more flexible than no code - Brad Appleton
- I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence - Kent Beck
- If you try to please everyone, you won't please anyone - 37signals
- When you're explaining something to somebody and they don't get it, that's not their problem, it's your problem - Jeff Atwood
- Fail to plan is plan to fail - Benjamin Franklin
- Simplicity is the ultimate sophistication - Leonardo Da Vinci
- If you can’t measure something, you can’t understand it. If you can’t understand it, you can’t control it. If you can’t control it, you can’t improve it - H. James Harrington
- Just because something is easy to measure, it doesn't mean it's important - Seth Godin
- The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet. — Michael A. Jackson
ecoologic's tech notes
Tech stuff around computer programming, basically for web development, especially opensource. Topics will go round Ruby on Rails (git gems etc.), Ubuntu (admin and basic shell) and work organization (agile philosophy)
Sunday 13 July 2014
Program Development - quotes
Friday 4 April 2014
Friday 12 July 2013
Wednesday 8 May 2013
regex to update from rspec 1 to rspec 2
Rspec 2 removes assign_to and replace it with assigns, here are the regex I'm using in sublime text 2 for the update:
Links to some doc here
should assign_to\((.*)\).with\(nil\) assigns($1).should be_nil should assign_to\(:(.+)\).with\((.+)\) assigns(:$1).should == $2 should_not assign_to\(:(.*)\) assigns(:$1).should be_nil should assign_to\(:(.*)\) assigns(:$1).should_not be_nil
Links to some doc here
Sunday 14 April 2013
quick upload to amazon S3 with Fog and Carrierwave
require 'rubygems' require 'fog' # version 1.10.1 fog_credentials = { provider: "AWS", aws_access_key_id: "QWERTTYQWERTTYQWERTT", aws_secret_access_key: "q1w2e3r4t5yQWERTYUq1w2e3r4t5yQWERTYasdf1", region: "ap-southeast-2" # Sydney ;) } CONNECTION = Fog::Storage.new fog_credentials S3 = CONNECTION.directories.get 'bucket-name' S3.files.create(key: 'test_me/test1', body: 'xxxxxxxxx')The following works with Carrierwave
require 'carrierwave' require 'fog' CarrierWave.configure do |config| config.fog_credentials = { provider: 'AWS', aws_access_key_id: 'QWERTYQWERTYQWERTYTY', aws_secret_access_key: 'qewr1234qewr1234qwer1234qwer1234qwer1234', region: 'ap-southeast-2' # Sydney :) } config.fog_public = false config.fog_directory = 'bucket-name' end class MyUploader < CarrierWave::Uploader::Base storage :fog end file = File.open('/tmp/tmp.txt') uploader = MyUploader.new uploader.store!(file)
Monday 18 March 2013
ruby operator precedence explained with an example
OR has lower precence than ||, in particular assignments (=) are in the middle, therefor:
Got it?
Where does it make sense to use the English operators?
Conclusion: only use English operators for flow control, not in if statements
also see this table
a = false || true # => true a # => **true** => a = (false || true) # BUT a = false or true # => true a # => **false** => (a = false) or true # another BIG difference :a || :b && :c # => :a => (:a || :b) && :c # BUT :a or :b and :c # => **c** => :a or (:b and :c)
Got it?
Where does it make sense to use the English operators?
a = value or raise "a cannot be nil" def tail_color(args) animal = args[:animal] and tail = animal.tail and tail.color end
Conclusion: only use English operators for flow control, not in if statements
also see this table
Sunday 10 March 2013
Subscribe to:
Posts (Atom)