...test, you can disable this behavior for pending features only. To make any pending call reconfigure the current cassette, you can simply redefine it. There is no official API to...

...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

...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...

...register the host in /etc/hosts or just connect to http://localhost/ restart Apache or call touch tmp/restart.txt in your project root SSL link /etc/apache2/mods-available/ssl.load and /etc/apache2/mods-available/ssl.conf into /etc/apache2/mods-enabled using sudo...

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...

github.com

...via Spring preloader in process 14679 Loading development environment (Rails 5.2.2.1) Traceback (most recent call last): .../lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:175:in 'fork': No such file to load -- irb/encoding_aliases.rb (LoadError) .../lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:175:in...

...reject!' for nil:NilClass (NoMethodError) The solution is to upgrade the gem binding_of_caller to version 0.8.0. Found that solution here...

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 }

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...

We usually put these constants in a Pattern class, so we can call them like Pattern::EMAIL...

...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...