...binary, do not install Ubuntu's node package. Instead, you need to create a symlink that points to the binary one of the nodejs package: sudo ln -s /usr/bin/nodejs /usr/bin/node...

...You probably already installed NodeJS. In case you did not: sudo apt-get install nodejs If you already installed the node Ubuntu package, bower will just do nothing (i.e. not...

...disable hiding URL parameters, open up Tools → Preferences (Ctrl+F12) → Advanced → Browsing and check "Show full web address in address field". No need to touch opera:config. The badge that...

...displays the page's "zone" (Web, Secure, Opera, ...) will be shrinked so you can still see a yellow lock for proper SSL connections, etc...

Find conditions for scopes can be given either as an array (:conditions => ['state = ?', 'draft']) or a hash (:conditions => { 'state' => 'draft' }). The later is nicer to read, but has horrible security...

...versions of Ruby on Rails. Affected versions Version Affected? Remedy 2.3.18 yes Use chain_safely workaround 3.0.20 no 3.1.x ??? 3.2.22 yes Use Rails LTS 3.2 with hardened configuration...

askubuntu.com

I was annoyed that RubyMine's autocompletion did not work via Ctrl+Space for me. In fact, it did not work in any application. Turns out that keyboard combination was...

...hijacked by Ubuntu as it's the default for switching input languages (i.e. keyboard layouts). If you use only 1 language/layout, you will not notice except for the key not...

live.julik.nl

The linked article provides a good overview of the various concurrency primitives in Ruby, and what's changing in Ruby...

You must reconfigure the guest so it will get its own IP address: Shutdown the guest In the guest's VirtualBox settings, choose Network and switch the network adapter type...

...Unix) or ipconfig (Windows) You can now connect to this IP address using HTTP, SSH, etc. Note that by doing this your VirtualBox guest is fully exposed on the local...

askubuntu.com

...not play nice with gnome-open. You can fix the problem by uninstalling it: sudo apt-get remove exo-utils Note that this may also uninstall XFCE tools like xfce4...

makandra dev

...an npm package. Naming convention for pre-release versions An npm package must use Semantic Versioning's naming convention for its version. In Semantic Versioning, the version number and pre...

...release identifier (like rc1) must be separated by a dash, like this: 1.0.0-rc1 2.3.0-alpha2 3.0.0-beta3 Publishing to a pre-release tag npm packages have multiple "current" releases...

To reduce download time, application servers usually serve content using gzip compression, if the browser supports it. When using a tool like Wget to explicitly download an application's response...

...the server responds with the uncompressed version: wget http://example.com/ If you are curious about the compressed file's size, pass the corresponding HTTP header: wget --header="accept-encoding: gzip...

By default, Twitter Bootstrap's print styles include printing links. /* Bootstrap's way of printing URLs */ @media print { a[href]:after { content: " (" attr(href) ")"; } } If you want to turn that...

Since May 2011 we are cutting new gems using Bundler, which is less painful than cutting gems using Jeweler. You know a gem was cut using Bundler if you see...

This is how to update a gem that was cut using Bundler: Say git pull or check out a repository from Github like git clone git@github.com:makandra/geordi.git

stevesouders.com

You can use scheme-less URLs (or protocol-relative URLs) to have browsers use the current protocol (HTTP or HTTPS) when loading content referenced with such an URL.

...relative URL doesn’t contain a protocol. For example, http://stevesouders.com/images/book-84x110.jpg becomes //stevesouders.com/images/book-84x110.jpg Browsers substitute the protocol of the page itself for the resource’s missing protocol. Problem solved...

Sometimes you want to see what data you get through a TCP or UDP connection. For example, you want to know how a HTTP Request look like.

...easy with netcat. Example to listen on port 80 and the output gets to stdout. sudo nc -kl 80 It's also possible write it into a file:

...will never return the current element itself, even if the element matches the given selector. Require the attached file and you can now say: $('.container').findWithSelf('.selector')

makandra dev

...methods and properties) video = document.querySelector('video') video.play() video.pause() video.load() // Reset to the beginning and select the best available source video.currentSrc // The selected source video.currentTime // The current playback time (in seconds...

...video.ended // Whether the video has finished video.muted video.paused video.readyState // See comments video.volume Comments controls makes the browser show its own video controls The image given in poster will be shown...

Ruby's String#split returns an array of substrings from the given string. Usually, this is missing the split characters: >> 'user@example.com'.split('@') => ["user", "example.com"] If you want to join those...

...parts later on, you might know the split character and can just use it to join explicitly. But if you split by a regular expression (for a set of split...

makandra dev

When you're getting this error, one possibility is that you've created a select field for an association instead of the associated object's id. Example: form.select :unit, Unit.for...

will be expected to deliver a real Unit object, whereas form.select :unit_id, Unit.for_select will make Rails typecast the String value from the select field to the unit...

makandra dev

You have to specify the environment with -e env_name or RAILS_ENV=env_name if you want to run a script on the server. at Rails 2 it's...

bundle exec script/runner -e env_name path/to/script.rb argument1 argument2 ... at Rails 3 it's rails runner RAILS_ENV=env_name bundle exec rails runner path/to/script.rb argument1 argument2...

Sometimes you want to have a time in a given timezone independent from you Rails timezone settings / system timezone. I usually have this use case in tests. Example

...results e.g. 2020-08-09 00:00:00 +0200 depending on the Rails timezone settings / system timezone. But in this example we always want to have the given time in...

coding.smashingmagazine.com

JavaScript engines such as Google’s V8 (Chrome, Node) are specifically designed for the fast execution of large JavaScript applications. As you develop, if you care about memory usage and...

...what’s going on in your user’s browser’s JavaScript engine behind the scenes...

commandlinefu.com

The colors in Rails log files are helpful when watching them but, since they are ANSI color codes like ^[[4;36;1m, can be annoying when you are reading the...

...that does just prints those control characters (like less or vim). Remove them with sed: cat staging.log | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m...

pganalyze.com

It's every developer's nightmare: SQL queries that get large and unwieldy. This can happen fairly quickly with the addition of multiple joins, a subquery and some complicated filtering...

...logic. I have personally seen queries grow to nearly one hundred lines long in both the financial services and health industries. Luckily Postgres provides two ways to encapsulate large queries...

Sometimes you want Angular to watch an object only until a certain state is reached (e.g. an object appears in the scope). Angular's $watch returns a method that you...

...can call to remove that watch. For example: unwatch = $scope.$watch 'user', (user) -> if user?

unwatch()

makandra dev
ishadeed.com

Table Of Contents Flexbox wrapping Spacing Long content Prevent an image from being stretched or compressed Lock scroll chaining CSS variable fallback Using fixed width or height...

...The fixed height The fixed width Forgetting background-repeat Vertical media queries Using justify-content: space-between Text over images Be careful with fixed values in a CSS grid