This file contains 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
MRI - detect with a lambda complains about 2 parameters but map works | |
$ irb | |
2.1.1 :001 > lambda = ->(word, index) { word.length == 3 } | |
=> #<Proc:0x007fb52d00ab38@(irb):1 (lambda)> | |
2.1.1 :002 > %w(Hi there how are you).each_with_index.detect &lambda | |
ArgumentError: wrong number of arguments (1 for 2) | |
from (irb):1:in `block in irb_binding' | |
from (irb):2:in `each' | |
from (irb):2:in `each_with_index' |
This file contains 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
Motion::Project::App.setup do |app| | |
app.info_plist['API_BASE_URL'] = ENV['API_BASE_URL'] || 'http://api.myserver.com' | |
end | |
task :cucumber => [:stub, :'build:simulator', :'calabash:run'] | |
task :stub do | |
ENV['API_BASE_URL'] = 'http://stub.example.com' | |
end | |
This file contains 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
alert('hi') |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am alexrothenberg on github. | |
* I am alexrothenberg (https://keybase.io/alexrothenberg) on keybase. | |
* I have a public key whose fingerprint is BD37 11A2 4CA9 9DC3 FE1F 1F4B E978 24DB 3CDB 639F | |
To claim this, I am signing this object: |
This file contains 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
"use strict"; | |
angular.module('gatewayApp') | |
.factory('Cache', [function(){ | |
var cache = {}; | |
var _get = function(key) { | |
var cacheHit = cache[key]; | |
if (_exists(cacheHit) && _notExpired(cacheHit)) { | |
return cacheHit.value; | |
} else { |
This file contains 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
'use strict'; | |
describe('Offers : controller', function(){ | |
beforeEach(module('client')); | |
var $scope, | |
genericService; | |
This file contains 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 Person #existing implementation | |
def find_by_name name | |
filter = adapter.create_equality_filter('uid', "*#{name}*") | |
results = find(:base => '', :attributes => attribute_mapping.values, :filter => filter) | |
build_array_of_people_from results | |
end | |
def find_by_exact_name name | |
filter = adapter.create_equality_filter('uid', "#{name}") | |
results = find(:base => '', :attributes => attribute_mapping.values, :filter => filter) | |
if (results.size > 1) |
This file contains 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 to_factory model | |
model.columns.each do |c| | |
if c.null == false | |
value = case c.type | |
when :integer | |
"7" | |
when :string | |
"'hi'" | |
when :boolean | |
'false' |
This file contains 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
# Install admin_data | |
plugin 'admin_data', :git => 'git://github.com/alexrothenberg/admin_data.git' | |
This file contains 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
# In DOS type | |
### cd \workshop | |
### mkdir ruby_exercises | |
### cd ruby_exercises | |
# Open the e editor | |
### e . | |
# Create a new file called string_exercise.rb |
OlderNewer