...bin/spring stop pkill -f spring To prevent Spring from starting again: export DISABLE_SPRING=1
...change their title from the prompt, run this function: function tab_title { if [ -z "$1" ] then title=${PWD##*/} # current directory else title=$1 # first param fi
{ :key => '_myapp_session', :domain => :all, # :all defaults to da tld length of 1, '.web' has length of 1 :tld_length => 2 # Top Level Domain (tld) length -> '*.myapp.web' has...
...server with lvh.me:3000 or anysubdomain.lvh.me:3000. Another way is, to add mysub.domain.web to /etc/hosts like 127.0.0.1 localhost mysub.domain.web Some developers suggest to write a rack middleware, but at the moment I...
@instance, @@class, $global = [ 'instance', 'class', 'global' ] puts "#@instance, #@@class, #$global" Infinite arrays ring = [1, 2, 3].cycle p ring.take(5) # => [1, 2, 3, 1, 2] I haven't made...
...in Ruby as defined by ISO 8601, use Date#cwday, which returns values in 1..7 (mind the range difference to Date#wday). The first week of the year is...
...it. All days in this week belong to the year. This means that January 1st, 2nd and 3rd may or may not be part of the previous year's last...
...say you want to merge the properties of two JavaScript objects: let a = { foo: 1, bar: 2 } let b = { bar: 3, baz: 4 } let merged = merge(a, b) // => { foo: 1...
...zone name by doing time_object.zone. This zone is considered when doing time calculations, e.g. 10 AM CEST minus 8 AM UTC is zero. A datetime in MySQL does not have...
...a zone. It just stores the literal string "2010-05-01 12:00:00". That means that Rails must make assumptions about timestamps loaded from and written to MySQL.
...JavaScript Event objects, the DOM element that triggered the event is attached to them. [1] However, there are 2 "opinions" on which element that would be: The element that the...
...callbacks, you usually want to do things with the element they are bound to. [1] Note that some MouseEvents also have other targets...
...works only at the beginning of the matched string, looks for a number (\d+ [1]) and also captures that. Sweet. However, mind that your input will not be magically escaped...
...the string. Simply pass them as a second argument: new RegExp('foo', 'i'); # => /foo/i [1] Note that we need to say "\\d" in our string when we want our string...
...the same every time: expect(object).to receive(:foo).with('argument').and_return('response 1', 'response 2') If the argument list differs between invocations: expect(object).to receive(:foo).with...
...argument 1').ordered.and_return('response 1') expect(object).to receive(:foo).with('argument 2').ordered.and_return('response...
...class @NestedHash @read: (objekt, keys...) -> if objekt and keys.length @read objekt[keys[0]], keys[1...]... else objekt @write: (objekt, keys..., value) -> objekt ?= {} if keys.length key = keys[0] objekt[key] = @write...
...objekt[key], keys[1...]..., value) objekt else objekt = value Jasmine-Spec describe 'NestedHash', -> describe '.write()', -> it 'writes nested values to a hash', -> hash = {} NestedHash.write hash, 'level1', 'level2', 'value' expect(hash...
...thus keeping any extra attributes: var index = element.indexOf(subElement); if (index > -1) element.splice(index, 1...
...interaction was still possible. This apparently happens to all IntelliJ IDEs, especially on Ubuntu 14.04. I've managed to fix it by having a shell script that exports XMODIFIERS="" when...
...alternate solution suggested on the Jetbrains issue tracker is setting IBUS_ENABLE_SYNC_MODE=1. #!/bin/sh IBUS_ENABLE_SYNC_MODE=1 /home/arne/rubymine/bin/rubymine.sh This seems fix issues on RubyMine 8.
...ObjectInUse: ERROR: database "foo_development" is being accessed by other users DETAIL: There is 1 other session using the database. This could be the rails server, rubymine and many more...
...session connection manually you can also find out the pid and kill the process. 1. rails db 2. SELECT * FROM pg_stat_activity; datid | 98359 datname | foo_development
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