github.com

...setting it to Timecop's time, pass a { tick: false } option to the timemachine.config() call. Note that this will not change the browser's time zone. If you mock the...

...and background sections. The reason is that with background jobs (e.g. methods that are called by a cron job) some variables are not available for exception notifier, e.g. @request and...

...will crash itself and not send a mail! With foreground jobs, exception notifier gets called automatically when an error raises. For background jobs, exceptions need to be catched and delivered...

tl;dr: Ruby's Bundler environment is passed on to system calls, which may not be what you may want as it changes gem and binary lookup. Use Bundler.with_original...

BUNDLE_GEMFILE RUBYOPT Basically, that environment is being passed on the child calls, so when you say bundle exec and then inside make system calls.

ruby-doc.org

...That being said the shown process also works without creating a lock file by calling File.open(@file_path) {...

...} on the file directly instead. I will also include an example on...

Since you can't write a directory you also don't have to call #close on it...

Restart X Add a launcher icon to your gnome panel. The command to call is /home/$USER/bin/rubymine/bin/rubymine.sh. For the icon there is a nice SVG of the RubyMine logo...

...to disable Rails internal (per-request) cache. For this, wrap your code with a call to ActiveRecord::Base.uncached. For example, as an around_filter: def disable_cache ActiveRecord::Base.uncached do...

...function that rejects: async function failingFunction() { throw new Error("Something went wrong") } When you call that function in a test, your test will fail: it('has a test', function() { failingFunction...

...have access to the rejecting promise. This can happen if the failing function is called by another function, but its rejecting promise is never returned: function wrappingFunction() { // Note we're...

...lead to this strange error (without stacktrace): irb > recipient = Recipient.find(123) Traceback (most recent call last): TypeError (nil can't be coerced into Integer) irb > recipient #<Recipient ...

This seems to be obvious, but you can expect Rake tasks to be called in RSpec. it 'deletes all Users' do FactroyBot.create(:user) expect(Rake::Task['notify:critical_operation']).to...

Note: Try to avoid logic in rake tasks and prefer to just call classes in them. Example: desc 'Some task' task :some_task do SomeClass.new.run

...Consider these methods: def stuff puts 'yielding...' yield puts 'yielded.' true end We can call our stuff method with a block to yield. It works like this: >> stuff { puts 'hi...

...is Rails' capture: def capture(*args, &block) # Return captured buffer in erb. if block_called_from_erb?(block) with_output_buffer { block.call(*args) } else # Return block result otherwise, but protect...

If you have an html_safe string, you won't be able to call gsub with a block and match reference variables like $1. They will be nil inside the...

...global match object $~. While the block itself will be passed on by the super call, its global match bindings are no longer valid, as they are reset when entering a...

makandra dev

...process is still alive. Here is how to do this: In your God config, call the Rake task with an environment variable PIDFILE. This variable should equal the PID file...

makandra dev

Step into the current line step (s) Step out finish (f) Print caller stack backtrace (bt) Go one level up in the caller stack without moving the debugger...

Go one level down in the caller stack without moving the debugger down Add a new breakpoint from an existing debugger session break : \ For example: break app/models/user.rb...

end end Step 3: Deploy and execute migrate! After deployment you can call your method in a script like this: Attachment.find_each { |attachment| attachment.file.migrate! } with class Attachment

...to expose your JS classes globally. // filePath is a relative path like "./foo.coffee". // The call to "substring" removes the "./" prefix. let preparePath = function(filePath) { return filePath.substring(2); }; modelFiles = require.context('js/models...

...setTimeout(() => window.CapybaraLockstep.stopWork(taskName), delay) }) } } if (window.CapybaraLockstep) { // lock capybara for all changes to fields with callbacks up.compiler('[up-observe]', (formOrField) => { return lockCapybaraForObservedChanges(formOrField, { taskName: `[up-observe]: ${formOrField}` }) }); up.compiler('[up-autosubmit]', (formOrField...

...up-autosubmit] and [up-validate]. For uses of up.observe or up.autosubmit, you need to call the lockCapybaraForObservedChanges function directly. You can use it like this: import { lockCapybaraForObservedChanges } from './path/to/the/file/above' // ...

makandra dev
semaphoreci.com

...seems the deploy.rb and deploy/*.rb files are only meant for configuration, i.e. many calls to set : , . Custom tasks should live in lib/capistrano/tasks/*.rake. The deploy:restart task is not...

...directory instead of the directory you might have specified with within(...) do. I would call that a bug, but the core team disagrees. Basically, execute and capture commands behave like...

Solution 1 Use the keyword argument allow_label_click: true within the method call. So instead of check('Some label'), use check('Some label', allow_label_click: true).

...Perhaps you ran into ActionView::MissingTemplate error and this card might help. If you call render_to_string within the format.json block, Rails will only look for an index.json template...

...uniq(x) // => [1, 2] _(x).uniq() // => [1, 2] If you want to chain multiple calls, you need to start off with a _.chain, and call value() to terminate the chain...

...map(function(i) { return i + 10 }).reverse().value() // => [12, 11] LoDash In LoDash, methods called from _ (like _.uniq) will behave as in Underscore. However, using _(...) implies chaining and most (!) methods...

makandra dev
iamvdo.me

...as if each line-box starts with a zero-width character (that the spec calls a strut) vertical-align:middle is never really “at the middle” An inline element has...

...Memoized methods are now faster at runtime. This will only be noticable if you call a memoized methods many times in the same request. We published our fork as a...

...ps2eps is actually just a wrapper around the GhostScript tool gs. Technically, you can call gs yourself, but ps2eps does lots of magic for you (it's a Perl script...

...0x00007f55f023c6f0 @attributes=[:partner_id, :name], @options={}>, #<ActiveRecord::Validations::UniquenessValidator:0x00007f55f1417e88 @attributes=[:name], @klass=UserGroup (call 'UserGroup.connection' to establish a connection), @options={:case_sensitive=>true, :scope=>:partner_id}>, #<ActiveModel::Validations::NumericalityValidator...

...0x00007f55f023c6f0 @attributes=[:partner_id, :name], @options={}>, #<ActiveRecord::Validations::UniquenessValidator:0x00007f55f1417e88 @attributes=[:name], @klass=UserGroup (call 'UserGroup.connection' to establish a connection), @options={:case_sensitive=>true, :scope=>:partner_id...