makandra dev

This will reduce the filesize of foo and bar to 0 bytes: truncate -s0 foo bar If the files do not exist they will be created. You can use this...

...to easily truncate your application's log files: truncate -s0 log/*.log

...have to write an HTML message for some weird reason. Here is how: Hold the Shift-Key while clicking on "Write", "Reply", "Reply All", or "Forward".

makandra dev
ablogaboutcode.com

...the following way: if object is a block, it converts the block into a simple proc. if object is a Proc, it converts the object into a block while preserving...

...the lambda? status of the object. if object is not a Proc, it first calls #to_proc on the object and then converts it into a block...

Let's say you have a folder images and want to to move all files in there to a new subfolder public. cd images mkdir public mv !(public) public

...public) excludes the new subfolder itself from being moved...

...its columns, you can use the following CSS property: table-layout: fixed It is supported by every browser ever...

guides.rubyonrails.org

When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly all commands. # Migrate rake db:migrate rake db:migrate STEP...

...rake db:migrate VERSION=20080906120000 # Redo rake db:migrate:redo rake db:migrate:redo STEP=2 rake db:migrate:redo VERSION=20080906120000 # Rollback (starting from latest migration) rake db:rollback...

web.archive.org

...original DOM (template element) before AngularJS creates an instance of it and before a scope is created. Use the pre-link function to implement logic that runs when AngularJS has...

makandra dev
skillsmatter.com

With Rails 4, Concerns have become the “official” solution to the big-models problem. However, there’s a fair amount of controversy about this topic in the community. Not everyone...

...is convinced that Concerns are the “right“ solution to the problem of AR models becoming too big. In this talk we will see what Rails Concerns are and how can...

When you put a Rake task into lib/tasks, but running it fails with... Don't know how to build task...

...or overflow directives in your CSS. Remove and tags in proximity of your table (seriously...

makandra dev
ruby-doc.org

not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's Guide...

Safari & Chrome Use $x() in your console: $x('//span') # selects all span elements Firefox There's an add-on...

...write this instead: expect(value).to eq(true) expect(value).to eq(false) See also RSpec claims nil to be false

wiki.snom.com

If your Snom 300 always keeps the same volume for headset and ringtone (as soon as you change one you also change the other), here's what to do:

...to your phone settings web interface, then Preferences (German Präferenzen). There is the seemingly harmless setting for Ringer Device from Headset (German Klingeltonausgabe bei Kopfhörer). Choose one: "Headset" or "Speaker...

makandra dev
github.com

Richard Powell presents a collection of CSS styling advice that's mainly taken from SMACSS. Although at makandra we're using BEM instead of SMACSS, here's my favorites.

...not use ID's in CSS Selectors It is never safe to assume there will only ever be one of something on a page so do not use ID's...

stritar.net

Since I'm a software architect and a web developer, I get often approached by people with their new ideas. In most cases, for some quality feedback, and on lucky...

...rough quote about the costs of such a project. These people are usually very secretive about what they have, making me explain to them that it's far from my...

stackoverflow.com

url = 'http://www.foocorp.com/foo/bar' URI.parse(url).host # => www.foocorp.com Note that this will raise an error if the given argument is...

jetbrains.com

...base revision from which both conflicting versions are derived You can also use a similar pane view to compare to files. Mark two files and press Ctrl + D to compare...

If you're on Ubuntu: sudo apt-get install ruby-dev On other platforms: Look for a package containing ruby header files. On Red Hat that's "ruby-devel" likely...

If you get the above error when running tests in bulk (but not individually), it's actually the fault of...

When you drag a file from a Nautilus window into a terminal window, the file's path will be pasted...

ruby-toolbox.com

If you need a gem for a certain purpose, be sure to check this site. The rankings are determined by counting up the number of forks and watchers of various...

...under active development and fairly up to date, and it's very useful to see groups of gems broken down by category...

benmabey.com

Bryan talked about the differences between imperative and declarative scenarios. In my opinion, both styles have benefits and should be used appropriately based on the situation. The majority of examples...

...on rspec's story runner currently on the web, including mine, are of the imperative type. Since the declarative type has many advantages I thought it would be worth while...

makandra dev
nexts.github.io

Small (1.5 KB) Javascript library that lets you render tables, lists, etc. with hundreds of thousands of items. How it works is that you move your data set from the...

...DOM into JS. Clusterize than makes sure only the rows in the viewport (and adjacent batches) are rendered. I believe that AngularUI's data grid component uses a similar technique...