...for a suitable revision there. Once you know where you want to downgrade to, call it once again # portdowngrade net-mgmt/collectd5 r497411 portdowngrade does NOT change /usr/ports in any...

postgresql.org

...arrays, true story.) Adding values Use the array_cat function, or the || operator. These calls will add the values "cats" and "mice" to users.topics: UPDATE users SET topics = array_cat...

...with_advisory_lock gem but you could easily use something else. class SidekiqMailersThrottle def call(worker, job_options, queue) if queue == 'mailers' ApplicationRecord.with_advisory_lock('mailers-throttle') do yield

...scope, but what if you need to pluck Global IDs? While you could just call map(&:to_global_id) on your scope, this approach would instantiate each record just to...

...This can easily be achieved through a Sidekiq middleware as follows. class RailsLoggerSidekiqServerMiddleware def call(worker, job_options, queue) tags = [worker.class.name, worker.jid] Rails.logger.tagged(*tags) { yield } end end Sidekiq.configure_server do...

...Text bundle offers a command Remove Trailing Spaces in Document / Selection, which you can call before saving. This is not aware of git (i.e., which lines YOU have edited).

...a shortcut like Cmd + Alt + Backspace. Update: Since 9-29-2012, TextMate2 has a callback will-save. In the above command, set 'Semantic class' to callback.document.will-save, and it will...

ruby-doc.org

This class contains nerdcore things such as disassembling a piece of Ruby into VM calls or enabling tail-call optimization. Also see this article about enabling TCO on a per...

...form.build_nested_records(:actors, :minimum: 4, name: 'Foo', active: true) If you want to call a different method rather than build, you can pass a block: form.build_nested_records(:actors...

...are now responsible for cleaning up myScope when you're done with it, by calling myScope.$destroy(). Javascript's garbage collection will not do this for you.

# code to run if the expression changes This watcher will continue to be called indefinitely unless you clean up after yourself: observer = -> # observe expression unsubscribe = $rootScope.$watch observer, (new...

...tags and triggers. Tips for implementing tracking with Google Analytics Each kind of tracking calls needs its own tag, e.g. "filter toggled", "load more clicked", "page view" etc.

...inject Javascript. Useful for e.g. defining a GA Opt-Out function that can be called e.g. from a link with href="javascript:gaOptOut()" Tracking tags should have an exception trigger...

makandra dev

Other html stuff If there is only one fragment to cache you can call the cache method inside your view without any parameters. Then it will automatically use the...

...do |expected_column| row.any?{ |column| column.include?(expected_column) }.should be_true end end end Call it like Then I should see the following users table: | Name | Is Admin? | | Alice | Yes...

...is cached somewhere so you only need to write them once. To reconfigure later, call s3cmd --configure. Once you're done setting up, s3cmd gives you shell-like commands like...

...uploader dynamically generates the filename (e.g. by incorporating a user's name), you must call model.save! after recreating versions. uploader.recreate_versions! does not update the model with the stored filename...

...crash when Power.current is nil. This is the case when your model isn't called as part of processing a browser request, e.g. on the console, during tests and during...

...a long selection of class methods that behave neutrally in case Power.current is nil: Call Equivalent Power.for_model(Note) Power.current.present? ? Power.current.notes : Note Power.for_model(:updatable, Note) Power.current.present? ? Power.current.updatable_notes : Note...

makandra dev

...to look into this helper script. You don't need to change stuff that calls rake because rake is already Bundler-aware. Bundler replaces the Cucumber version hack

See this note Kernel#returning has been deprecated in favor of Object#tap. (called from enable_activerecord at /.../gems/will_paginate-2.3.14/lib/will_paginate.rb:39) Update will_paginate gem to version >= 2.3.15

...Use #listify instead. Using #request_uri is deprecated. Use fullpath instead Upgrade gems that call #request_uri. Some gems that do this (like ssl_requirement) are no longer maintained. In...

...and waited until the debugger was triggered In the debugger we looked up the caller by first running raise, then wtf???????????? in pry (wtf is a pry command, the more...

end Be aware that it will run some_expensive_calculation every time you call var_value if some_expensive_calculation returns nil. This illustrates the problem: def some_expensive...

...is the essential implementation. Remember In the above example, some_expensive_calculation is never called again. This might be what you want, but if you are looking for something in...

makandra dev

...former value) after the block has ended. A nice shortcut is that when you call with_power with an argument that is not already a Power, Consul will instantiate a...

...initializer that cleans up line breaks: module ActionController module Session CookieStore.class_eval do def call_with_line_break_fix(*args) status, headers, body = call_without_line_break_fix(*args) headers...

...n", "\n" if headers['Set-Cookie'].present? [ status, headers, body ] end alias_method_chain :call, :line_break_fix end end end Put that into a file like config/intializers/cookie_store_with_line_break_fix.rb and you...

makandra dev

This tool is used on our application servers (and called when deploying) but it also works locally. Just call dumple development from your project directory to dump your database.

...they are not aliased), update has been changed on SessionHash. SessionHash#load_for_write! calls load! internally which prepares some data in the session hash. The same happens when you...

...you need to tell it which Firefox to use for Selenium tests. If you call Cucumber using the cuc script (also part of the geordi gem), this will happen automatically...