explainshell.com

...with each option explained. About Hello, This site contains 29761 parsed manpages from sections 1 and 8 found in Ubuntu's manpage repository. A lot of heuristics were used to...

...will open an debugging IRB right away, like this: require File.dirname(__FILE__) + '/../config/boot' (rdb:1) _ Enter c to continue and reach your actual debugger call. Then, debug away.

...can feed it to block-taking methods by prefixing it with &: printer = method(:puts) [1, 2, 3].each(&printer) # will print one line per number

stats = {} ObjectSpace.each_object {|o| stats[o.class].nil? ? stats[o.class] = 0 : stats[o.class] += 1 }; stats => {String=>192038, Array=>67690, Time=>2667, Gem::Specification=>2665, Regexp=>491, Gem::Requirement=>16323...

makandra dev

Make sure the daemon is running. Error: Process /usr/lib/sflphone/sflphoned exited with status 1 This mean the last process didn't shut down properly and let a PID file...

...If you've shut sflphone down some seconds ago, you just have to wait 10 seconds and don't have to remove the pid file manually...

imperialviolet.org

...and no special hardware. On our production frontend machines, SSL/TLS accounts for less than 1% of the CPU load, less than 10KB of memory per connection and less than...

...With a block, it counts the number of elements yielding a truthy value. ary = [1, 2, 4, 2] ary.count #=> 4 ary.count(2) #=> 2 ary.count { |x| x...

...weekdays (Monday to Friday) between to given dates, try this: require 'date' a = Date.parse "11.04.2014" b = Date.parse "31.12.2014" (a..b).count {|date| (1..5).include?(date.wday...

The following snippet will convert a string with wildcards to a appropriate regexp, i.e. parse_wildcards("foobar") # => /\Afoo.bar\z/

execute "SET @pos := 0;" update " UPDATE pages SET position = ( SELECT @pos := @pos + 1 ) ORDER BY updated_at DESC...

When your block takes an argument that should have an default, only in Ruby 1.9 you can say: block = lambda do |message, options = {}| # ... end If you are on Ruby 1.8.6...

...or 1.8.7 you must resort to the following workaround: block = lambda do |*args| message = args[0] options = args[1] || {}

makandra dev

...to a variable and further want to use it. Example: irb(main):001:0> 1 + 2 => 3 irb(main):002:0> _ => 3 irb(main):003:0> a...

jimneath.org

...and many more you'll need when reading weird code. Regex $~ (last MatchData) $1 $2 $3 $4 (match groups from the last pattern match) $& (last matched string) $+ (last match...

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

makandra dev
magnus-g.github.io

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

unixetc.co.uk

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

makandra dev
github.com

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

tldp.org

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

makandra dev

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

apidock.com

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

stackoverflow.com

...regexp !~ string) The Ruby 2.4 method Regexp#match? does not set globals like $~ or $1, so it should be more performant...