I hereby claim:
- I am krekoten on github.
- I am krekoten (https://keybase.io/krekoten) on keybase.
- I have a public key ASCzazLorWv2-JO6OYcsbs_c030huC7eD9S6868bAW6N1Ao
To claim this, I am signing this object:
| const window = Dimensions.get('window') | |
| const styles = StyleSheet.create({ | |
| containerStyle: { | |
| overflow: 'hidden', | |
| width: window.width, | |
| height: window.width / 2 | |
| }, | |
| contentContainerStyle: { | |
| borderRadius: window.width, | |
| width: window.width * 2, |
I hereby claim:
To claim this, I am signing this object:
| $ ruby -e "5.instance_exec { p self }" | |
| 5 | |
| $ bin/topaz_untranslated.py -e "5.instance_exec { p self }" | |
| -e:1:in `instance_exec': can't define singleton (TypeError) | |
| from -e:1:in `<main>' |
| class CollectionPresenter < Presenter | |
| def to_hash | |
| @model.inject(Hash.new { |h, k| h[k] = [] }) do |hash, element| | |
| element_hash = Presenter.factory(element, options).to_hash | |
| hash[element_hash.keys.first.to_s.pluralize.to_sym] << element_hash.values.first | |
| hash | |
| end | |
| end | |
| end |
| require'action_controller' | |
| run(r=ActionDispatch::Routing::RouteSet.new) | |
| r.draw{root :to=>->e{[200,{'Content-Type'=>'text/html'},["Hello"]]}} | |
| #twitter size rails3 app :) |
| def tip(msg); puts; puts msg; puts "-"*100; end | |
| # | |
| # 30 Ruby 1.9 Tips, Tricks & Features: | |
| # http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
| # | |
| tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
| tip "Ruby 1.9 supports named captures in regular expressions!" |
| # Ruby 1.9.2 | |
| ruby-1.9.2-p0 > class O; end | |
| nil | |
| ruby-1.9.2-p0 > O.new(1,2,3) | |
| #<O:0x00000100a9fcf8> | |
| # Ruby 1.8.7 | |
| irb(main):001:0> class O; end |
| require 'benchmark' | |
| class A | |
| def initialize | |
| @etag = 'ETag' | |
| end | |
| def etag | |
| @etag | |
| end |
| # A couple years ago the Rails community discovered the joys of factory | |
| # builders as an alternative to fixtures. Rails developers have had | |
| # bad experience with fixtures since a long time due to several reasons | |
| # including misuse. | |
| # | |
| # This misuse is often characterized by a huge ammount of factories, | |
| # causing a lot of data to maintain and dependence between tests. In my | |
| # experience working (and rescueing) different applications, 80% of these | |
| # factories are used only by 20% of tests (which are usually tests that | |
| # need a huge ammount of data to test different scenarios). |
| class Proc | |
| def <<(other) | |
| case other | |
| when Proc | |
| Proc.new do |*args| | |
| call(other.call(*args)) | |
| end | |
| else | |
| call(other) | |
| end |