lines = [] File.open(cucumber_paths, 'r').each do |line| lines << line.slice(/\s+when /^?([^$]*)$?/[im]?$/, 1) # @param 1: return first matched group end paths = lines.compact.sort TextMate::UI.complete(paths, :extra_chars => " ")
...Sidekiq is running @reboot start_sidekiq 23 8 * * * baz 30 * * * * plop 5 8 * * * bar 1 0 * * * foo # End Whenever generated tasks for: project100 While you can human-parse this one...
Output for the example above will be: @reboot start_sidekiq 30 * * * * plop 1 0 * * * foo 5 8 * * * bar 23 8 * * * baz If you want to sort by day...
...That means the following code in routes.rb … resources :users do resource :profile, controller: 'users/profiles' #[1] end … makes Rails expect the following directory structure: app/ controllers/ users/ profiles_controller.rb users_controller.rb ... views/
show.html.haml index.html.haml ... Note: the user profiles controller must be named Users::ProfilesController [1] specifying the controller as 'user/...' would make Rails expect views in view/user/... (singular) The better approache...
Note that you cannot currently use Ruby 1.9.2 with Rails 2 applications that use RSpec, so don't upgrade if that is your setup. The rspec-rails gem has a...
...x, which only supports Rails 3. There is no fix for the rspec-rails-1.3.x series of the gem which supports Rails 2. Anyway, here are upgrade instructions if...
...see any changes in your debugged gem. Howto Disable spring with export DISABLE_SPRING=1 in your terminal. That will keep Spring at bay in that terminal session.
# Spring leads to all kinds of unexpected behavior in tests. ENV['DISABLE_SPRING'] = '1' block.call end
...that undoes the old changes. Imagine the following commit history: * commit_sha3 [Story-ID 1] Fixup for my feature * commit_sha2 [Story-ID 5] Other feature * commit_sha1 [Story-ID...
You can revert a single commit using the following syntax: git revert commit_sha2 To revert changes that are split across multiple commits, use the --no-commit...
If you open a pop-up window [1] in your Selenium tests and you want to close it, you can do this: # Find our target window handle = page.driver.find_window("My...
...any subsequent steps will break when you are not pointing to a correct window. [1] as in: a real browser window, maybe via window.open in JavaScript
...file called test.file. You would then run this: dd if=/dev/zero of=test.file bs=1048576 count=23 The block size (bs) is set to 1 MB (1024^2 bytes) here...
mb = 23 mb_string, _error_str, _status = Open3.capture3('dd if=/dev/zero bs=1048576 count=1') tempfile = Tempfile.open('some_file.txt') do |file| mb.times { file.write(mb_string) } file end
...record a h264 encoded video. record command when using ffmpeg (for e.g. with ubuntu 12.04) cat some_acces.log | logstalgia --sync -1920x1080 --output-ppm-stream - | ffmpeg -y -r 60 -f image2pipe...
...vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 logstalgia.mp4 record command when using avconv(for e.g. with ubuntu 14.04) cat some_acces.log | logstalgia...
...to pass the desired format as a String, not a Symbol: get :show, :id => 1, :format => 'pdf' # works get :show, :id => 1, :format => :pdf # does not work
it 'does something' do pending end it 'does something else' do pending expect(1).to eq(1) end The first case may be unexpected, if you just wanted to...
...it properly or you will "randomly" get errors like these: wrong number of arguments (1 for 0) (ArgumentError) wrong number of arguments (0 for 1) (ArgumentError) Take a look at...
def tp(objects, *method_names) terminal_width = `tput cols`.to_i cols = objects.count + 1 # Label column col_width = (terminal_width / cols) - 1 # Column spacing Array(method_names).map do...
...cells.map{ |cell| cell.to_s.ljust(col_width) }.join ' ' end nil end Usage examples: tp Video.where(key: '123'), :created_at, :updated_at, :published tp [album1, album2], :title, :image_count
...ve forked it so it works for Rails 2.3.x applications running on Ruby 1.9. [1] makandra/mongomapper is based on the "official" rails2 branch [2] which contains commits that were...
...added after 0.8.6 was released. Tests are fully passing on our fork for Ruby 1.8.7, REE, and Ruby 1.9.3. To use it, add this to your Gemfile: gem 'mongo_mapper...
I had this error: > gem install bundler Successfully installed bundler-2.0.1 1 gem installed > bundle install Traceback (most recent call last): 2: from /home/henning/.rbenv/versions/2.5.1/bin/bundle:23:in ` ' 1: from /home/henning/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb...
...Probably missing gem: ' + gem_name print 'Auto-install it? [yN] ' gets.strip =~ /y/i or exit(1) system(install_command) or exit(1) # retry Gem.clear_paths puts 'Trying again ...' require gem_name...
...By default, output is sorted by directory name, not size: du -h --max-depth=1 . 40K ./a 2.3G ./b 3.1M ./c 500M ./d 2.8G .
...h switch does the magic of understanding humanized size formats): du -h --max-depth=1 . | sort -h 40K ./a 3.1M ./c 500M ./d 2.3G ./b 2.8G .
A haml angular 1 template with .thing(class="is-{{:: item.type }}") will be compiled (by haml) to which is not what you want! It will also crash in angular (unless thing...
...with Error: [$parse:syntax] Syntax Error: Token 'thing' is an unexpected token at column 11 of the expression [item.type thing] Solution 1: Use ng-class instead of class
...linked article shows what current browsers do when you click a link like this: 1-562-867-5309 Spoiler: The current state is sad It's still the case that...
...warning Integrity check: System parameters don't match error Integrity check failed error Found 1 errors. ======================================== Your Yarn packages are out of date! Please run `yarn install --check-files` to...
def scenario_ended return unless session.driver.is_a?(::Capybara::Selenium::Driver) self.driver_scenario_count += 1 if !browser_died? && driver_scenario_count >= MAX_SCENARIOS_PER_DRIVER kill_session! end end
end end class CustomHttpClient < Selenium::WebDriver::Remote::Http::Default def initialize(open_timeout: 10, read_timeout: 60) super end private def response_for(request) if Reaper.browser_died? raise 'Waiting...
...date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch..merge in git-config(1...
...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" This will add a...
In shell scripts you can use $1 to refer to the first argument, $2 for the second, etc. If you want to refer to all arguments (e.g. when writing a...
...and passes them on to another call), you may not want to do a “$1 $2 $3 $4 ...”. Use $@ instead, like in this script: $ cat welcome #!/bin/bash