Sometimes you may want to print files from the command line, especially when you have lots of them. You can use lp for that. To print a single example.pdf file...
...on your default printer, simply say: lp example.pdf lp accepts multiple filenames, so to print all PDF files in the current directory: lp *.pdf You can specify a printer via...
...MySQL and you know the "error" is okay (e.g. you've executed the same statement at the same time on 2 masters which sync each other), you can skip this...
...error and continue with the replication without having to set up the slave from the ground up. stop slave; set global sql_slave_skip_counter = 1; start slave;
See the attached link for a useful overview of modern (and classic) DOM API methods, like matches, contains, append, cssText, etc. You will still need to look up some documentation...
...e.g. on how to modify a ClassList, but it's still better than browsing interfaces and superclasses of Element on MDN without knowing what to look for. When coming from...
...written in pure Ruby and integrates with Rails applications. It provides features as automatic sizing of dots and lines (the more values, the thinner the graph's elements), custom or...
...predefined themes, different styles (bar, line, dot and many more) and multiple graphs in one chart. Installation In your Gemfile: gem 'rmagick', :require => false gem 'gruff' Then run bundle install...
...entering only http://example.com/). If you want to make a request to that site's web server without actually talking to www.example.com (e.g. because this is a load balancer...
...s address but you want to access one specific machine), you cannot just request machine1.example.com or localhost as the above vhost will redirect your request. When talking HTTP 1.1, your...
The sprintf method has a reference by name format option: sprintf("% d : % f", { :foo => 1, :bar => 2 }) # => 1 : 2.000000 sprintf("%{foo}f", { :foo => 1 }) # => "1f" The format identifier % stands for...
...this example we are using %s identifier to replace strings. class Fetcher FIND_URI = 'https://someapi.com/3/search/record?query=% s&include_many=% s&language=en-US&page=1' # some public methods
How to ignore new files Globally Add the path(s) to your file(s) which you would like to ignore...
Chromedriver (or selenium-webdriver?) will not reliably scroll elements into view before clicking them, and actually not click the element because of that. We've seen this happen for elements...
...a 40px button). Our assumption is that the element is considered visible (i.e. Capybara::Selenium::ChromeNode#visible? returns true for such elements) but the Selenium driver wants to actually click...
can’t find executable rails for rails-3.2.3 (Gem::Exception) ... one of several...
...things might be wrong. You're using RVM It's possible that you have a system-wide gem executable (like rails) that requires a gem that is not available in...
On your local system that only hosts non-critical development data and only you have access to, you can store MySQL's root password in your home directory so you...
...out of the question if there's any confidential data in your databases. Assuming diligent screen-locking, an encrypted hard disk and correct permissions set on your credential file, it...
You have an async function that rejects: async function failingFunction() { throw new Error("Something went wrong") } When you call that function in a test, your test will fail:
}) The failure message will look like this: Unhandled promise rejection: Error: Something went wrong You can fix this by expecting the state of the returned promise:
In CI test runs I noticed that string sorting order changed after switching from a debian-based PostgreSQL docker image to one that is based on Alpine Linux.
...sorting: bar Bar foo Foo Alpine image sorting: Bar Foo bar foo Explanation Alpine Linux is a very slim linux distribution that results in small docker image sizes (roughly 100MB...
A comprehensive introduction to sending HTML emails. Intro: HTML email: Two words that, when combined, brings tears to a developer’s eyes. If you’re a web developer, it’s...
...in your career, whether you like it or not. Coding HTML email is old school. Think back to 1999, when we called ourselves “webmasters” and used Frontpage, WYSIWYG editors and...
Spreewald's patiently repeats the given block again and again until it either passes or times out. Be careful to give patiently a block that can actually be repeated. E.g...
...the field variable that was defined outside of the block (it's the variable set from the Given block's arguments). Because of this, during the first repetition the value...
...run rake and your code is causing an exception which is not the one shown in your terminal. Rails tries to catch this exception and clean up constants but -- while...
...it's still booting up -- fails on this which causes another exception: rake aborted! cannot remove Object::ClassMethods Running rake with the --trace parameter will give you no love; the...
...what git checkout and git reset do. Git basics A commit holds a certain state of...
...a directory and a pointer to its antecedent commit. A commit is identified by a so-called ref looking something like 7153617ff70e716e229a823cdd205ebb13fa314d. HEAD is a pointer that is always pointing...
Capistrano automatically logs each (successful) deployment into a file on your application servers. It is located at the root of your server's project folder, i.e. the parent of releases...
...and current, like so: /var/www/your-project$ ls current log releases repo revisions.log <--- here shared Each line in that file contains the deployed branch, commit, release ID, and username (was read from...
Having a unique selector for an element is useful to later select it from JavaScript or to update a fragment with an Unpoly. Haml lets you use square brackets ([]) to...
...with ActiveRecord instances, which have a persisted #id and will hence generate the same selector over multiple renderings of the same view. Example - @users.each do |user| .row[user] = user.name
...the transcluded content before adding it to the DOM. # Directive template: """ """ transclude: true link: (scope, element, attributes, _controller, transclude) -> transclude (content) -> # Do custom stuff element.find('.wrapper').append(content)
...much more you can do with the transclusion function. For an in-depth introduction, see this Guide to Angular Transclusion. Also read the Angular docs on this...
You can scale background images in CSS to the container size using background-size (Demo). Commonly, we use contain or cover because we want to preserve the image's aspect...
If you do not want to do that, simply provide scaling values for X and Y: background-size: 100% 100% (a simple 100% would mean 100% auto and respect...
In Rubocop you might notice the cop Style/CaseEquality for e.g. this example: def foo(expected, actual) expected === actual end In case expected is a Regex, it suggests to change it...
...foo(expected, actual) expected.match?(actual) end In case expected is a Regex or a String, you need to keep ===. Otherwise the actual expression is always converted to a regular expression...
...you want to clean up this code with the modularity gem, you might try something like this: class Foo does 'bar' end module BarTrait as_trait do class Bar
...you would have to change all references accordingly, which is quite unpleasant. You can solve it like that: module BarTrait as_trait do class self::Bar end end end
gem install foobar --version="=2.3.0.alpha2" Also bundle update will never update a stable version to a pre-release version unless the user explicitly requests it in the Gemfile...
...gem 'foobar', '=2.3.0.alpha2' A note on Semantic Versioning Semantic Versioning has a naming convention for pre-releases that is incompatible with that from RubyGems. In Semantic Versioning, the version...
Web forms can be made much more usable with a few HTML attributes. Short summary: type: Tells browsers about the input data type. Mobile browsers will select a virtual keyboard...
...based on this value. Some browsers will add simple validation, e.g. for type email. inputmode: Direct hint about the virtual keyboard to use. Inferred from type, but can be very...