...Import the icon-font by adding a file icon_font.sass: $icon-prefix: '-' @import "generated/icon_font_icons" $size: 1em * $line-height-base // only works with bootstrap .icon // adjust some styles display: inline-block
height: 1em font-size: $size -moz-osx-font-smoothing: grayscale -webkit-font-smoothing: antialiased text-rendering: auto font-style: normal font-weight: normal line-height: 1 // We can not...
...invert the pattern. @include texture(green, 34, 0); // color, texture-number, 0=inverted or 1=normal If you have ever done this manually you know how much pain this can...
...list all branches matching your query as input options for git checkout greckout ar 1) ar/cache-api-keys-1098 2) ar/add-categories-object-to-tv-show-1382...
When a directory has more than a few thousand entries, ls will start taking really long to list its content...
I've encountered a Ubuntu 16.04 today, where localhost resolved to ::1 instead of 127.0.0.1. This will not usually make a difference, but could be relevant for firewall policies...
...from your current database state. The generated db/seeds.rb will look this: Product.create!([ { category_id: 1, description: "Long Sleeve Shirt", name: "Long Sleeve Shirt" }, { category_id: 3, description: "Plain White Tee...
...Shirt", name: "Plain T-Shirt" } ]) User.create!([ { password: "123456", username: "test_1" }, { password: "234567", username: "test...
...the environment variable PIPESTATUS So you can just echo ${PIPESTATUS[@]} to get them all. 13:52:30 ✔ claus:~$ ps ax | grep /usr/bin/ruby 13205 pts/20 S+ 0:00 grep --color=auto...
13:52:43 ✔ claus:~$ echo ${PIPESTATUS[@]} 0 0 PIPESTATUS is an array, so you can get the exitcode of an specific command (first pipe): 13:54:20 ✔ claus:~$ echo...
...to a certain maximum, you can just compare against the modulus of that maximum + 1. \ For example, the following will yield results between 0 and 9: echo $(($RANDOM % 10...
...echo $(($RANDOM % 10)) 9 Note that this skews random numbers to the lower regions of your boundaries in most cases...
Dir.glob(File.join RAILS_ROOT, 'app', 'models', '*.rb').collect{ |path| path[/.+\/(.+).rb/,1] }.collect(&:camelize).collect(&:constantize...
Note: The behaviour of Spreewald's within step is as described below for version < 1.9.0; For Spreewald >= 1.9.0 it is as described in Solution 1. When doing integration testing with...
# Feature When I pick "Lions" from the album picker within ".media-picker-1" # Step definition When /^I pick "(.+?)" from the album picker$/ do |label|
...# open the picker and...
...an integer and want to use it to represent an element's position (like "1st" for 1, or "2nd" for 2), you can use ActiveSupport's ordinalize: 1.ordinalize # => "1st"
1002.ordinalize # => "1002nd" 1003.ordinalize # => "1003rd" -11.ordinalize # => "-11th" -1001.ordinalize # => "-1001st...
...regexp !~ string) The Ruby 2.4 method Regexp#match? does not set globals like $~ or $1, so it should be more performant...
Service that you can integrate for user feedback. Super-simple integration: Add a tag to your layout, done. It will then add a button to the bottom right of your application. When a user clicks it, they can take a screenshot and leave a message. The screenshot then appears in TrackDuck's interface for you to work off. Current pricing is 9 USD per month for the smallest tier (1 project).
Hashrocket Lunch n' Learn #1 with Avdi Grimm: Making Little Classes out of Big Ones A look at the pros and cons of four different techniques for breaking a too...
...can declare it’s finally here. We’ve brought the work of more than 1,600 contributors together to make everything better, faster, cleaner, and more beautiful...
...form and populate a preview div with the response. $('content_form').request({ parameters: { 'preview': "1" }, // overrides parameters onComplete: function(transport){ $('previewContent').update(transport.responseText...
...to determine if it's possible to generate a string that matches more than 1 of them. Short of writing my own regex engine with this use case in mind...
...you can simply skip asset compilation and re-use the previous release's assets. [1] That is especially easy via Capistrano. Capistrano will automatically symlink your release's public/assets to...
end You can then set the above environment variable when deploying: SKIP_ASSETS=1 cap staging deploy Enjoy. [1] Sprockets will pick any public/assets/.sprocket-manifest-*.json...
...shouldn't do for performance reasons), there are several ways to work around this. 1. Use it_should_receive_callbacks The awesome it_should_run_callbacks macro from spec_candy...
...callback chain and run that. This is what spec_candy wraps for you (method #1). describe Spaceship do describe '#launch' do it 'should run the proper callbacks' do subject.state = 'docked...
...reactivate the new version Shut down RubyMine Extract the downloaded file into your ~/bin/. [1] cd ~/bin && tar xzvf ~/Downloads/RubyMine-X.Y.Z.tar.gz Update your directory symlink [2] to point to the new...
...to update it, too. Go to Tools → Create Command-line Launcher… and confirm twice. [1] We recommend using ~/bin to store binaries for your user. Some of us like to...
...of it. If not, someone could exploit this by creating a user with ID = 1 (e.g. on staging), sign in and then use that cookie to authenticate on another site...
...e.g. on production, where the user with ID = 1 probably is the admin). Here is a one-for-all solution that does not affect current production users, leaving the production...
...browsers will use CSS transforms when available -- which is on basically all but IE. [1] To achieve a rotation on IE8 and IE9, we can use writing-mode. Since other...
However, IEs that do support transform (IE10+) would combine both styles into a 180° rotation which we do not want. So we reset our transform definition for IEs -- and...
...w!#$%&'*+-/=?^`{|}~]+.)*[\w!#$%&'*+-/=?^`{|}~]+@((((([a-z0-9]{1}[a-z0-9-]{0,62}[a-z0-9]{1})|[a-z]).)+[a-z]{2,6})|(\d{1,3}.){3}\d{1,3}(:\d{1...
...find your test results when you come back to the console later Calls RSpec 1 (spec) in a Rails 2 project and RSpec 2 (rspec) in a Rails 3 project...