Context: CodeAcademy asked for code like:
var = gets.chomp
var2 = var1.capitalize
var.capitalize!
#...| ### Keybase proof | |
| I hereby claim: | |
| * I am daveworth on github. | |
| * I am dworth (https://keybase.io/dworth) on keybase. | |
| * I have a public key ASAFs93Uo_d2oN4aKnPp2P_rEGyNRYpUntFfM1wpS170nAo | |
| To claim this, I am signing this object: |
Context: CodeAcademy asked for code like:
var = gets.chomp
var2 = var1.capitalize
var.capitalize!
#...| def square_with_continuation(x, continuation = ->(x) { x }) | |
| continuation.call(x*x) | |
| end |
| require 'spec_helper' | |
| describe "First Class Objects are Weird" do | |
| let(:a_lambda) { lambda { |p| puts ["Lambda", p].join(" ") } } | |
| let(:a_proc) { proc { |p| puts ["Proc", p].join(" ") } } | |
| context "wat" do | |
| pending "totally does not work" do | |
| foo = double # was hoping to find out what method was called on this double... it doesn't work | |
| %w(a).each &foo |
| $ ssh-add -D | |
| All identities removed. | |
| $ ssh-add ~/.ssh/id_rsa | |
| Enter passphrase for /Users/dworth/.ssh/id_rsa: | |
| Identity added: /Users/dworth/.ssh/id_rsa (/Users/dworth/.ssh/id_rsa) | |
| $ ssh -T [email protected] | |
| Hi daveworth! You've successfully authenticated, but GitHub does not provide shell access. | |
| $ ssh-add ~/.ssh/deploy_id_rsa | |
| Identity added: /Users/dworth/.ssh/deploy_id_rsa (/Users/dworth/.ssh/deploy_id_rsa) |
| class WidgetDecorator::Base < ApplicationDecorator | |
| def display_title | |
| "" | |
| end | |
| end | |
| class WidgetDecorator < WidgetDecorator::Base | |
| decorates :widget | |
| def display_title | |
| #... |
| # running flog on an intentionally broken rails app | |
| badapp $ bundle exec flog -g app | |
| 76.9: flog total | |
| 7.7: flog/method average | |
| 20.2: UsersHelper total | |
| 20.2: UsersHelper#dynamic_attribute_finder? app/helpers/users_helper.rb:2 | |
| 18.9: UsersController total | |
| 10.4: UsersController#none |
| sexp = RubyParser.new.process(ruby) | |
| find_dstrs(sexp) | |
| # produces | |
| [s(:dstr, "foo bar ", s(:evstr, s(:lvar, :baz)), s(:str, " qux"))] |
| $ vim ~/.reflecticle | |
| $ cat ~/.reflecticle | |
| d669464d57d4242b74c7c7f45725b5c1b9e4f35d | |
| $ rspec | |
| .... | |
| Finished in 0.03198 seconds | |
| 4 examples, 0 failures | |
| $ cat ~/.reflecticle | |
| key |
| class Thingy < ActiveRecord::Base | |
| attr_accessible :name, :inty | |
| scope :name_eql_sqli, lambda { |param| where("name = #{param}") } | |
| scope :name_eql_no_sqli, lambda { |param| where("name = ?", param) } | |
| scope :name_eql_squeeli, lambda { |param| where{name == param} } | |
| scope :inty_eql_squeeli, lambda { |param| where{inty == param} } | |
| scope :name_like_sqli, lambda { |param| where("name LIKE '%#{param}%'") } |