...the initial migration.\ So, in your new migration, just include the old one and call it: require 'db/migrate/20120201031337_add_population_to_destinations' class DropPopulationFromDestinations < ActiveRecord::Migration def self.up AddPopulationToDestinations.down end def self.down AddPopulationToDestinations.up

return new Promise(function(resolve, reject) { ... }); } } It's hard to handle errors when calling foo, since we need to handle both a synchronous throw and an asynchronous rejection. Look...

...return Promise.reject("No x given") } else return new Promise(function(resolve, reject) { ... }); } } Now your caller only needs to handle async failure: function onFulfilled() {...

function onRejected() { // handle async failure }

...s Bundler environment will shadow that of the test application. To fix this, just call unset_bundler_env_vars in a Cucumber Before block. Previously suggested solution Put the snippet...

makandra dev

...you need to turn to linear functions. The mixin below gives you just that. // Call with two desired values at two different widths. // Returns a calc() expression that will scale...

makandra dev

...cache the result after calculating it once. However, you can trigger a recalculation by calling #life_universe_and_everything(true). If, however, your method looks like def life_universe(and...

...everything = false) ... end memoize :life_universe a call to #life_universe(true) will actually trigger a reload and not pass the parameter at all. To clarify: This not only disables...

...You will also need Ubuntu development packages for MySQL, RMagick, etc. The bundle install call will otherwise fail for such projects...

The most common use case for Ruby's #collect is to call a method on each list element and collect the return values in a new array: ['hello', 'world', 'this...

...If you are using the Prototype framework, there is also a method called pluck: ['hello', 'world', 'this', 'is', 'nice'].pluck('length...

...is, you must tell the debugger to evaluate your expression. One workaround is to call irb to open an irb session at your breakpoint. Resume by sending Ctrl+D twice...

#<OrderItem id: 111471, quantity: 5,...

The debugger has a setting called autoeval that will make it pass any unknown command to the breakpoint environment. Set it...

makandra dev
dev.mensfeld.pl

Turns a Hash into a Proc that returns the corresponding value when called with a key. May be useful with enumerators like #map: attrs.to_proc.call(:name) attrs.keys.grep(/name/).map...

...curb dependencies: gem webmock, '>= 1.8.0' gem curb, '>= 0.7.16' For me this happened when stubbing calls for Savon, which was using Curb in the background...

...that you need to remove trailing white space from the result of the system call. >> `hostname` => "happycat\n" >> `hostname`.strip => "happycat" Note that this is about the machine's hostname...

makandra dev
github.com

...in geordi) and mark others as deprecated Add hint to README about how to call the local geordi during development

...Put the attached script into e.g. /usr/local/bin and make it executable. Now you can call fullscreen Safari and Safari will go full screen. Notes This script needs activated access for...

jasmine.github.io

...helper that you can use to travel through time and trigger setTimeout and setInterval callbacks: beforeEach(function() { timerCallback = jasmine.createSpy("timerCallback"); jasmine.clock().install(); }); afterEach(function() { jasmine.clock().uninstall(); }); it("causes a timeout...

...to be called", function() { setTimeout(function() { timerCallback(); }, 100); expect(timerCallback).not.toHaveBeenCalled(); jasmine.clock().tick(101); expect(timerCallback).toHaveBeenCalled(); }); If you actually want the test to wait out the timer, your example...

In the tradition of our PostgreSQL cheat sheet for MySQL lamers, here is a cheat sheet for Jasmine when you...

...often include Javascript code that contains values from Ruby variables. E.g. you want to call a Javascript function foo(...) with the argument stored in the Ruby variable @foo. You can...

The most obvious way to use spring is to call it explicitly: spring rails console spring rake db:migrate Binstubs Binstubs are wrapper scripts around executables. In Rails they...

...Spring by setting the environment variable DISABLE_SPRING. Obviously, this does not work when calling Spring explicitly...

github.com

...like user.version_at(10.hours.ago). Diffing attribute changes : Access a Version directly, like user.versions.last and call its changeset: user.versions.last.changeset => { 'first_name' => [ 'Alice', 'Bob' ], 'gender' => [ 'female', 'male' ] } Tracking who made the changes...

Calling Time#utc, Time#gmt or Time#localtime will not create a converted copy. Instead these methods modify the receiving Time object: >> time = Time.now

...code is holding pointers to the Time object you are modifying. To be safe, call these methods on a clone of the Time object. You can clone a Ruby object...

...to_json(*args, &block) my_custom_representation.to_json(*args, &block) end That way, outside code can call your to_json method any way they like...

...Deprecation.behavior = lambda do |msg, stack| unless msg =~ silenced_expr ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:stderr].call(msg, stack) end end This will only work with warnings that go through ActiveSupport and...

...remove this message, you'd have to update the gem that makes the API call, I'm afraid...

...to provide the font face tags within your public folder. You have to explixitly call it within the ckeditor/config.js. You also might be interested in CKEditor asset pipline support...

...such things in your controller you should -- as always -- not trigger something that eventually calls the thing you want.\ Instead, in your specs, have resource_controller run those hooks like...