...outfile out.pdf one.pdf two.pdf Pages from joined documents might be rotated. To avoid this, call it like this: pdfjam --outfile out.pdf --fitpaper true --paper a4paper --rotateoversize false one.pdf two.pdf

...lib/rack/cookie_stripper.rb. module Rack class CookieStripper ENABLED = false def initialize(app) @app = app end def call(env) Request.new(env).cookies.clear if ENABLED @app.call(env) end end end Next, configure your application...

class AuthenticatingResqueServer < Resque::Server class ClearanceAuthentication def initialize(app) @app = app end def call(env) @request = ActionDispatch::Request.new(env) remember_token = @request.cookies["remember_token"] if skip_authentication? or (remember_token.present...

task :bar, :roles => :something do # do crazy stuff end end Whenever we call foo.bar in our recipe, Capistrano will fail if you deploy to a stage where none...

...avoid the above error message.\ Now, when Capistrano enters a hook and tries to call a method that is only available for that group of servers, you'll get another...

...the client finally. While this is possible, I'd recommend to use what AWS calls "Query String Authentication". If you're using Paperclip you can chose between two storage adapters...

...your_model.document.expiring_url => "http://s3-eu-west-1.amazonaws.com/your-bucket/files/foo/bar/123/456/ab/cd/1/2/3/original/Attachment.pdf?AWSAccessKeyId=ABSJASHJK232JAHBS&Signature=V6aJhal2kaB4bxKal23lSMV%2F9w%3D&Expires=1347889426" The expiring_url method carries out a web service call to S3 to gain the data for AWSAccessKeyId and Signature being used within the URL...

github.com

...cargo gives your API a new /batch route that lets clients perform multiple API calls with a single request. The batched calls are resolved internally and are then returned as...

...elastic did not recover. I had to explicitly disable readonly via the following REST call: curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null...

stackoverflow.com

To reload a single-item association in Rails 5+, call #reload_ : post.reload_author In older Railses you can say post.author(true...

stackoverflow.com

...work: Dig really deep In any case, Rails usually breaks on the blame_file! call where it tries to show you the source of the error. You can (temporarily) hack...

...Rails' require call in .../gems/activesupport-2.3.12/lib/active_support/dependencies.rb and show the error before Rails gets it into its hands: def require(file, *extras) if Dependencies.load? Dependencies.new_constants_in(Object) { super } else super

edgeapi.rubyonrails.org

Starting from Rails 4.0, you can use a special form options helper called #collection_check_boxes. It behaves similar to #collection_select, but instead of a single select field it...

You can customize the output by passing a block. The block will be called with a special builder object that has a handful of special methods. See the complex...

scope.parentFn(arg1: 'first', arg2: 'second') In this dumb example, the panel directive will call its scope's parentFn() function with two arguments, which proxies to parent.someFunction('first', 'second'). But...

@app.directive 'panel', -> restrict: 'E' scope: parentFn: '&proxy' link: (scope) -> scope.parentFn(arg: 'the argument') ... calls parent.someFunction('fixed argument', 'the argument'). Tested in Angular 1.3. Also see Angular directive scope binding...

...RestClient.get or RestClient::Request.execute. In that case, RestClient will not raise an error, but call the block with 3 block arguments: a RestClient::Response the RestClient::Request for your request...

...an underlying Net::HTTP result, e.g. Net::HTTPUnprocessableEntity The called method will then return the return statement of the block. So this will just return the response object of a...

...Move your current Sass file into a partial. Let's assume it was called screen.sass. Rename it _screen.sass. Step 2 Create two new Sass files: Call this one screen.sass:

@import screen Call this one screen_for_ie.sass: $ie = true @import screen Step 3 Change your page head to something like this: <%= stylesheet_link_tag 'screen', :media => 'screen' %>

If others on a call (Skype, SIP, ...) can not hear you loud enough, your volume levels are probably too low. Also, Skype may be changing your mixer levels.

...you have more than one recording device, find the correct one. Make a test call to a colleague that can tell you if it's too loud or too quiet...

...your recompile hit. To dig further, you may add options to the new SpeedMeasurePlugin call. Example: const smp = new SpeedMeasurePlugin({ outputFormat: "humanVerbose", loaderTopFiles: 20 }) const config = environment.toWebpackConfig() module.exports = smp.wrap(config...

...migration, you might find this to be harder than you thought. While you can call ActiveRecord::Base.connection.execute(sql) to execute arbitrary SQL commands, the MySQL connection is configured to only...

...around this by opening a second MySQL connection that does accept multiple statements per call. Below is an example for a migration that loads a dump from db/production_structure.sql: class LoadDump...

...a "read on" link), and html_safe knowledge. Prefer the truncate() helper Warning: truncate() calls html_safe if you're not escaping. FWIW, an HTML string may easily become invalid...

...Rail application. Upgrading the gem to version 1.21.0 fixed the issue. Traceback (most recent call last): 17: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute' 16: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb...

...code with dozens of debug messages, it can be hard to find all those calls to puts and p. This note describes a hack that lets you trace those messages...

...foobar' at /home/henning/projects/notes/features/step_definitions/web_steps.rb:280:in `puts' When you're done, remember to remove that call to Undebug.trace_message because it will slow down your application...

...process the specified version or all versions, if none is passed as an argument. Call recreate_versions! on a mounted uploader. A common usecase User.all.each { |user| user.avatar.recreate_versions! if user.avatar...

...uploader dynamically generates the filename (e.g. by incorporating a user's name), you must call save afterwards, because recreate_versions! doesn't update the stored filename...

...repeat the last macro. This does not work instantly after recording, you need explicitly call the macro once. You can combine the above: 42@@ calls the last run macro...

def bar; end end module B end When you want to call methods from A inside B you would normally just include A into B:

...a module's method accessible from the outside. You could put the module_function calls into A but it would remain unclear to people looking at B's code.

Call with the server's hostname (and user if you have no SSH agent), e.g. install-gems-remotely my.server.com # or without agent: install-gems-remotely me@my.server.com When you call it...

...though that class inherits from Hash and often behaves like one, you can not call slice on it to select only a subset of cookies. Why? Because Hash#slice calls...