...nested projects. Then it's really helpful! This makes use of the CDPATH variable. Similar to the PATH variable, which holds the list of directories which are searched for executables...

Then add the following to your ~/.bashrc: export CDPATH=.:~/.bookmarks/ function mark { ln -sr "$(pwd)" ~/.bookmarks/"$1" } # Always resolve symbolic links (e.g. for bookmarks) alias cd="cd -P"

Expiration of Rails sessions By default Rails sessions expire when the user closes her browser window. To change this edit your config/initializers/session_store.rb like this: ActionController::Base.session = { :key => '...', :secret => '...' :expire_after...

} In older Railses the initializer is not available. Set the option in the environment.rb instead: config.action_controller.session = { :key => '...', :secret => '...' :expire_after => 10.years } Expiration of Rails cookies In addition to the...

makandra dev
blog.getbootstrap.com

Moved from Less to Sass. Bootstrap now compiles faster than ever thanks to Libsass, and we join an increasingly large community of Sass developers. Improved grid system...

...added a new grid tier to better target mobile devices and completely overhauled our semantic mixins. Opt-in flexbox support is here. The future is now—switch a boolean variable...

...wanted bundle update some_gem What is wrong Let's say your Gemfile asks for some-gem which you can see when running gem list but bundle show some-gem...

...just gives you an error: Could not find gem 'some-gem', in any of the sources Another indicator: Doing a bundle install --local breaks and bundle install installs every gem...

...you need to do it yourself. It's not that hard: Get more disk space Add an extra virtual hard disk to the machine with the disk size you want...

...the CD, open a terminal (on the guest, not the host!) and become root: sudo su fdisk -l to see the disk information. \ There should be one drive with some...

Spreewald gives you the within meta step that will constrain page inspection to a given scope. Unfortunately, this does not work with RSS feeds, as they're XML documents and...

...re inspecting XML that is invalid in HTML, you need to inspect the page source instead of the DOM. You may use Spreewald's "... in the HTML" meta step, or...

...and extract it:\ tar xvfz rubygems-1.3.7.tgz If you previously had RubyGems installed via apt: \ sudo apt-get remove rubygems Install RubyGems:\ cd rubygems-1.3.7 && sudo ruby setup.rb

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem If gem list does not show all gems you previously had, you can create a symlink to your old gem directory:\ cd /usr/local/lib/ruby && sudo...

...Consider this HTML: Hello World Lorem ipsum... Hello Universe Lorem ipsum... Now let's say you obtain a list of all such message containers as an array: messages = page.all('.message...

messages[0].find('h2', :text => 'Hello World').text => "Hello World" Now we search inside the same container as above, which contains "Hello World" as its headline. \

Most of the JavaScript snippets have code that manipulates the DOM. For that reason dom manipulating javascript code should have been executed after the DOM has loaded completely. That means...

...above would have the advantage not to pollute the global scope and to reduce unexpected side-effects...

...t requested an action for a while. Note that this is different from deleting sessions some time after the last login, which is the default. Also note that this is...

...probably a bad idea. Most sites keep sessions alive forever because having to sign in again and again is quite inconvenient for users and makes your conversion rates go down...

...a great jQuery library to make (large) fields more usable. For Bootstrap 3 there is select2-bootstrap-theme. It won't work for Bootstrap 4, but rchavik's fork does...

...if you have some. @import ~bootstrap/scss/bootstrap/variables @import ~bootstrap/scss/bootstrap/mixins @import ~font-awesome/scss/font-awesome @import ~select2/src/scss/core @import ~select2-bootstrap-theme/src/select2-bootstrap4.vars @import ~select2-bootstrap-theme/src/select2-bootstrap @import ~select2-bootstrap-theme/src/select2-bootstrap4.after

...gem 'cucumber_factory' Run bundle update on any added/changed gem, e.g. bundle update cucumber capybara selenium-webdriver database_cleaner cucumber_spinner Error messages & solutions uninitialized constant JSON -> Add gem 'json...

...to your Gemfile uninitialized constant Selenium -> Add gem 'selenium-webdriver' to your Gemfile Failing Cucumber steps that use find Capybara 1's #find method raises an error if nothing could...

creativecouple.github.com

...provides you some methods that help you to write readable and understandable method chains. See yourself: Example // before $('.some').show().children().doThat(); window.setTimeout(function(){ $('some').children().doSomething().hide(function() { window.setTimeout...

otherStuffToDo(); }, 1000); }); }, 500); // after $('.some').show().children().doThat() .wait(500) .doSomething().hide() . wait(1000) . otherStuffToDo(); jquery-timing transformed the setTimeout callback into a chainable method. Now the code is...

...give you the =~ matcher: actual_array.should =~ expected_array Rspec 3 With RSpec 3's expect syntax you can choose one of these two matchers: expect(actual_array).to match_array...

...but contain_exactly takes a list of elements as varargs. Test::Unit If you install shoulda-matchers you can say: assert_same_elements([:a, :b, :c], [:c, :a, :b])

Here is a hacky way to load dumps directly from the source server, without fully copying them over and extracting them first. It may break horribly for you. This is...

...the dark side of the force. Install pipe viewer, if you don't have it already: sudo apt-get install pv Know the location of the dump file on the...

...clean out the database before each example. Use :transaction where possible. Use :deletion for Selenium features or when you have a lot of MyISAM tables. Understanding database cleaning

...to clean out your test database after each test, so the next test can start from a blank database. To do so you have three options: Wrap each test in...

...language when they visit the root path. Here is how to do it without a server-side component (like a Rails application). Use JavaScript's navigator.language (real browsers and IE11...

...following JavaScript will try to auto-detect a user's preferred language. It understands strings like like de_AT, and if the user prefers neither of your supported languages it...

We use CarrierWave in many of our projects to store and serve files of various formats - mostly images. A common use case of CarrierWave's DSL is to "process" the...

...versions", for example different resolutions of the same image. Now we could go one step further: What if we want to create versions that have a different file extension than...

Selenium cannot reliably control a browser when its window is not in focus, or when you accidentally interact with the browser frame. This will result in flickering tests, which are...

...tests to complete. The solution is to run Selenium inside a VNC session so the Selenium-controlled browser doesn't pop up over your main work area. Understanding issues with...

github.com

...dependencies and database types. Here's what Gemika can give your test's development setup (all features are opt-in): Test one codebase against multiple sets of gem dependency sets...

...currently MySQL or PostgreSQL). Compute a matrix of all possible dependency permutations (Ruby, gem set, database type). Manually exclude incompatible dependency permutations (e.g. Rails 5.0 does not work with Ruby...

ruby.about.com

The flip-flop operator is a hotly contested feature of Ruby. It's still struggling to find an idiomatic use case, except for a few very rarely needed things. It...

...s not something you'll likely reach for on a daily, weekly or even monthly basis. The only thing you really need to know about it is what it does...

In Capistrano 2, directories in shared_children used to be symlinked to the shared directory during the finalize_update task. # /lib/capistrano/recipes/deploy.rb _cset :shared_children, %w(public/system log tmp/pids) # ... task :finalize...

...update, :except => { :no_release => true } do # ... shared_children.map do |d| run "ln -s #{shared_path}/#{d.split('/').last} #{latest_release}/#{d}" # <-- symlinks only the last segment here end # ... end This would symlink...

...could also use Haml instead. Example Consider the following helper. def greeting message = ''.html_safe message << 'Welcome to ' message << content_tag(:span, Rails.env, class: 'greeting--location') content_tag :div, message...

...That looks clumsy and is hard to read. Wouldn't it be nicer to say something like this? def greeting render_haml <<-HAML .greeting Welcome to %span.greeting--location = Rails.env

...below if you are affected by the issue: The field's content "" did not match "some-text" (RSpec::Expectations::ExpectationNotMetError) Issue with headless Chrome After removing the line above in...

...it could happen that the tests are no longer running in headless mode. Updating the selenium-webdriver gem to >= 3.13.0 fixed the problem. Issue with old Capybaras