stackoverflow.com

...the with_routing helper -- but that one destroys existing routes which may break a specs that require them to work. To keep both "regular" and test routes, do this:

...MyApplicationController < ActionController::Base def show render text: 'Welcome to my application' end end test_routes = Proc.new do get '/my_application' => 'my_application#show' end Rails.application.routes.eval_block(test_routes)

web.archive.org

With its you can switch the subject of an example to a method value of the current subject: describe Array do its(:length) { should == 0 } end stub_chain is the...

...tie to go along with should_receive_chain's tux: object.stub_chain(:first, :second, :third).and_return(:this) You can restore the original implementation of stubbed methods with unstub:

makandra dev
github.com

Katapult was an endeavor to dramatically speed up starting a new Rails application. However, it turned out to save less time than expected, while requiring more time for maintenance than...

...anticipated. Since its benefits fell too low, we have decided to not continue developing Katapult. You can still use Katapult for generating ready-to-run applications with model CRUD, authentication...

makandra dev

...false, you need to do it like this: nil.should == false # fails as expected Wat? See also RSpec: be_true does not actually check if a value is true

makandra dev

...the data to /tmp/geodb_coodinates.csv. And it's fast: Query OK, 337925 rows affected (0.86 sec) SELECT * INTO OUTFILE '/tmp/geodb_coordinates.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n...

blog.codeclimate.com

...than cluttering controllers with domain logic, they usually represent a failure to apply the Single Responsibility Principle (SRP). “Anything related to what a user does” is not a single responsibility...

...Early on, SRP is easier to apply. ActiveRecord classes handle persistence, associations and not much else. But bit-by-bit, they grow. Objects that are inherently responsible for persistence become...

wiki.qemu.org

...from a drive or image in a virtual machine you do not need to setup up a VirtualBox machine. Often QEMU does the job well enough. Install it:

...get install qemu To boot an ISO: qemu-system-x86_64 -cdrom filename.iso If you prepared a USB pen drive and want to test it, run it like this (/dev/sdx...

...you upgrade to the mysql2 gem, you will run into the problem that the server's database.yml (which is usually not under version control) needs to change exactly on deploy...

...can however make your database.yml work for mysql and mysql2 at the same time. Simpy do this production: adapter: <%= defined?(Mysql2) ? 'mysql2' : 'mysql...

Generally, Selenium tests use the browser to interact with the page. If it's unavailable, a timeout error is thrown. Now, consider a scenario like this: @javascript Scenario: Receive...

...When I follow "fancy link" Then I should have an e-mail with the subject "Hello" When the last step in the scenario passes, you are done. Right? Wrong.

Just a quick note that Virtus can coerce (auto-cast) structured values like collections or maps: class Klass include Virtus.model attribute :dimensions, Hash[Symbol => Float] attribute :numbers, Array[Integer]

makandra dev

I have no idea how it's supposed to work (or why the don't have a print CSS), but this works for pages written with Markdown: "Edit" the wiki...

docs.angularjs.org

In addition to the {{ myValue }} two-way binding syntax, since Angular 1.3 there's a one-time binding syntax, prefixing the value or expression with ::, e.g. {{ ::myValue }}, {{ ::myValue >= 42 }} and...

...myExpression(value) | someFilter }}. One-time bound expressions get dropped from the list of watchers as soon as they can be resolved. Performance-wise the impact for this small change is...

stackoverflow.com

...it can wipe the database. Importing a remote dump with geordi Asking Postgres to show the storage path of a database Doing these things without a superuser will show a...

...raise PG::InsufficientPrivilege. To do so, the application's PostgreSQL user must be a superuser. Grant superuser rights like this: $ sudo -u postgres psql # ALTER USER WITH SUPERUSER...

makandra dev
aws.amazon.com

...Transcoder is video transcoding in the cloud. It is designed to be a highly scalable, easy to use and a cost effective way for developers and businesses to convert (or...

...transcode”) video files from their source format into versions that will playback on devices like smartphones, tablets and PCs. This might be a good alternative for services like Panda which...

makandra dev

sudo apt-get install i8kutils Reboot You can now run the i8k tools such as i8kmon Setting the fan speed to high (2) will only work shortly as the fan...

...is somehow controlled automatically.\ This helps you out in bash: while true; do i8kfan - 2; sleep 0.2; done There should be a better solution and it will be posted as...

makandra dev
github.com

Richard Powell presents a collection of CSS styling advice that's mainly taken from SMACSS. Although at makandra we're using BEM instead of SMACSS, here's my favorites.

...not use ID's in CSS Selectors It is never safe to assume there will only ever be one of something on a page so do not use ID's...

...write this instead: expect(value).to eq(true) expect(value).to eq(false) See also RSpec claims nil to be false

If you paste multiple lines of text into a cell, Calc's AutoCorrect will change the first character of the...

...you want to inspect a method's magic), you need to enable it explicitly: script/console --debugger If you cannot access local variables etc, see this card. WEBrick For WEBrick, enable...

script/server --debugger

makandra dev
github.com

...to it if the content inside is too long. While you can only truncate single lines with CSS by using text-overflow, this small JavaScript library also allows truncating text...

...For Internet Explorer, the element you clamp on needs to have its line-height set in pixels. A relative value will not work. There is also the -webkit-line-clamp...

makandra dev
sitepoint.com

Scope is all about where something is visible. It’s all about what (variables, constants, methods) is available to you at a given moment. If you understand scope well enough...

...more importantly, which ones are not. The article gives detailed explanation on the variable scope in ruby with examples that are easy to understand. Every ruby developer should at least...

If you're getting this strange error message when setting debugging breakpoints, probably HAML is the culprit. Cause As far as I could find out, the error is the result...

...of setting a breakpoint (debugger) in a helper method that's called from a haml partial. Suggestions Try putting the breakpoint into the HAML view...

miekd.com

...or quote from an article is duplicated within the article using a different formatting style so that it jumps out at the reader. Blatantly copying the excerpt of the pull...

A pull quote is a purely visual technique, and therefore should not change the structure of the body. Next to that, a structural representation of the excerpt would be seen...

caniuse.com

There is a kinda secret, yet well supported CSS feature called currentColor. It's like a special CSS variable that has been supported in almost all browsers for almost all...

...time (see linked Caniuse). Usage The currentColor value can be used in CSS to indicate the current value of color should be used. A common use case is setting a...