jQuery comes with .animate() that lets you transition some CSS selectors: function floatIn($element) { $element.css({ 'opacity': 0, 'margin-top': 200px }); $element.animate({ 'opacity': 1, 'margin-top': 0 }, { duration: 500 }); }
...is implemented using setInterval and Javascript. This works great, but it's not as smooth as a CSS transition. Fortunately the animate API can be mapped almost 1:1 to...
Large projects usually have large test suites that can run for a long time. This can be annoying as running tests blocks you from picking up the next story -- but...
...it doesn't have to be that way! Simply clone your project's repo twice (or even more often). When your work on a feature branch is done, simply push...
...expression that forces a repaint (e.g. by computing an element's width, or running something like element.is(':visible')) you may end up with "page flickering" or scroll offset changes.
...to the end of a digest cycle to avoid that. The following is basically straight from the docs, but pretty awkward to use. Do it like this (example here is...
There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote_column_name(field) scoped(:select => "COUNT(DISTINCT #{field}) AS count...
Although the given variable is sanitized here, the MySQLAdapter's (and probably other adapters as well) method for this is insufficient as it only wraps backticks around it, not...
...not migrated yet). $ rake db:rollback $ If that happens to you, check your migration status. $ rake db:migrate:status up 20160503143434 Create users up 20160506134137 Create pages up 20160517112656 Migrate...
...to roll back the latest change that was migrated. In the case above, your schema_migrations table contains an entry 20160518112023 that you do not have the corresponding migration file...
When your site is mapped into the URL-space of another server using mod_proxy, ProxyPass and ProxyPassReverse, all requests in your Apache logs are logged with the IP address...
...of the proxying server. The IP address of the original client doing the request is not logged, making it difficult to trace problems and run statistics. Short answer
When you have a pending Cucumber step (or feature) that also uses an existing VCR cassette, your pending test may fail at the very end with an error like this...
...often a good configuration. If you do not want to change your whole test suite's settings because of a pending test, you can disable this behavior for pending features...
Let's say you need to revert a migration that happened a while back. You'd create a new migration that removes what was added back then in the up...
...do that. Especially when the up/down paths already contained some logic (that executed update statements on the created column, for example), copying does not feel right. Someone already added the...
Yesterday I stumbled across a talk in which the guy mentioned module sub-classing. I was curious what you can do with it and found his blog post with a...
...cool example. It allows you to inject some state into the module you are including elsewhere. Check it out! class AttributeAccessor < Module def initialize(name) @name = name end def included...
JavaScript structures that include circular references can't be serialized with a"plain" JSON.stringify. Example: a = { name: 'Groucho' }; b = { name: 'Harpo', sibling: a }; a.sibling = b; Doing a JSON.stringify(a) will...
...throw an error: TypeError: Converting circular structure to JSON There is not much you can do about that except specifying a custom serializer function that detects and cleans up circular...
...does not need to, be your LVM group name): cryptsetup luksOpen /dev/sda5 some_name Since your encryption container most likely contains an LVM group (root + swap for example), enable the...
...mkdir /mnt/ext-root), and then mount /dev/mapper/LVM_NAME-root /mnt/ext-root GRUB It is possible that GRUB (your system loader) will pick up on the new LVM group and add an entry to your...
...video plattform ("mycustomtv") in one of our applications. I learned a lot about naming stuff. youtube_mycustomtv_chooser is a bad name for a directive. Why? if you add, for...
...example, other video systems like vimeo, the name of the method either lies or will get longer. if you replace one system, you will have to change the method and...
Terminator has a cool feature that allows you to split your terminal into many panels and type in all of them at the same time. It's called broadcasting and...
...and could be very dangerous (e.g. if you're logged in to a production server in a terminal that is on another workspace). To prevent the broadcast from affecting other...
Spring is a Rails application preloader. When debugging e.g. the rails gem, you'll be wondering why your raise, puts or debugger debugging statements have no effect. That's because...
...Spring preloads and caches your application once and all consecutive calls to it will not see any changes in your debugged gem. Howto Disable spring with export DISABLE_SPRING...
The Capybara API is somewhat hard for parse for a list of methods you can call on a Capybara node. Below you can find such a list. It's all...
...credit goes to the Capybara committers. When you talk to Capybara from a Cucumber step definition, you always have page as the document root node, or whatever you scoped to...
When refactoring a sequence of steps to a new, more descriptive step, you can use the steps method and Ruby's %-notation like this: Given 'I have an article in...
steps %( When I go the article list And I open the first article And I press "Add to cart" ) end This way you can simply copy the...
CSS (+ some Javascript) framework, implementing Google's material design for static web pages. Can be used for plain websites without requiring a full blown Javascript framework, unlike the (also excellent...
...elements, or Angular material. Prelimiary impression: I would recommend against using it at this stage, for a couple of reasons: It is much less complete than you might expect from...
CustomLog "|/usr/sbin/rotatelogs /opt/www/awesome-project/log/access.%Y-%m-%d.log 86400" combined Adding that to your site's vhost will create log files that include the current date in their name, like...
...access.2011-04-20.log, without any need to restart the web server every night (like logrotate does). The last argument above is the rotation time in seconds -- here being...
...above should fix it for that one command. If you want to persist that setting, say the following. export LESSCHARSET=UTF-8 Put it into your ~/.bashrc and reopen all...
...terminals (or source ~/.bashrc in open terminals). Note that if you are having trouble with filenames, you should try changing git's core.precomposeunicode config setting...
Pie sometimes does not properly redraw elements upon changes. This often happens when the change comes from somewhere further up the DOM. Consider something like: Active element Inactive element
li .content { -webkit-box-shadow: #666 0px 2px 3px; -moz-box-shadow: #666 0px 2px 3px; box-shadow: #666 0px 2px 3px; behavior: url(/PIE.htc); background: white; } li.active .content...
Using the dialog command you can launch ASCII-art dialogs from your shell scripts. Check out man dialog for a list of supported dialog types. Aside from simple text boxes...
...or choice dialogs, it supports more advanced interactions like file pickers or progress bars. Example: Yes/no choice dialog --yesno "Erase the world?" 0 0 Example: Menu with multiple options
You may know the double asterisk operator from Ruby snippets like Dir['spec/**/*_spec.rb'] where it expands to an arbitrary number of directories. However, it is disabled by default on...
...most systems. Here is how to enable it. If you check your globstar shell option, it is probably disabled: $ shopt globstar globstar off In that case, ** behaves just like * and...
There are 3 built-in file descriptors: stdin, stdout and stderr (std=standard). (You can define your own, see the linked article.) Basic 0/1/2 references stdin/stdout/stderr >/2> redirects stdout/stderr, where...
&1/&2 references stdout/stderr &> redirects stdout and stderr = everything (caution: see below) Caution: &> is functional as of Bash 4. This seems to result in a slightly...
Browsers make this very hard. Even when you explicitely set the selection inside the textarea (e. g. using jquery-fieldselection) the browser will not scroll the textarea to this selection...
...What you can do instead is abuse browsers' behavior that they scroll to the end of a textarea when it gets focus. So we set the textarea's value to...