...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')

developer.chrome.com

In the DevTools settings, there's a "Shortcuts" section. Found these keyboard shortcuts there: General ESC Toggle drawer CTRL + ~ or CTRL + ` Show console in drawer Styles SHIFT + up/down

...debugging page repaint times) CTRL + hover above element in the DOM list Don't show the yellow dimensions tooltip (useful when the tooltip covers just the area you need to...

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...

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...

Deadlocks only occur if two transactions in separate threads compete for the same rows in the database. They usually (but not necessarily) only happen when trying to update or otherwise...

...lock several rows in different order. Solving deadlocks is potentially complicated, so here are a few pointers: MySQL should always detect the deadlock right when it happens, and will throw...

Current webkit browsers like Chrome and Safari have a special variable in their consoles that refers to the selected DOM node in the elements panel. This lets us easily inspect...

...Angular scopes. Right click in the page and click "Inspect" to open the Dev Tools Select the element you're interested in from the elements panel Focus the console (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...

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
devdocs.io

DevDocs combines multiple API documentations in a fast, organized, and searchable interface. Here's what you should know before you start: You don't have to use your mouse — see...

...the list of keyboard shortcuts The search supports fuzzy matching (e.g. "bgcp" brings up "background-clip") To search a specific documentation, type its name (or an abbreviation), then Tab

...clean out the database before each example. Use :transaction where possible. Use :deletion for Selenium features or when you have a lot of MyISAM tables. Understanding database cleaning

...to clean out your test database after each test, so the next test can start from a blank database. To do so you have three options: Wrap each test in...

When dealing with external data sources, you may have to deal with improperly encoded strings. While you should prefer deciding on a single encoding with the data-providing party, you...

...can not always force that on external sources. It gets worse when you receive data with encoding declaration that does not reliably fit the accompanying string bytes.

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...

We use CarrierWave in many of our projects to store and serve files of various formats - mostly images. A common use case of CarrierWave's DSL is to "process" the...

...versions", for example different resolutions of the same image. Now we could go one step further: What if we want to create versions that have a different file extension than...

There are several ways to merge two (or more) PDF files to a single file using the Linux command line. If you're looking for graphical tools to edit or...

...annotate a PDF, we have a separate card for that. PDFtk (recommended) PDFtk is a great toolkit for manipulating PDF documents. You may need to install it first (sudo apt...

web.archive.org

...context) is run outside of transactions, so data created here will bleed into other specs before(:example) is run before each spec inside it, Generally, you'll want a clean...

...setup for each spec so that they are independent of other specs in the same context. Example Consider this spec: describe User, 'something' do before :context do @user = User.make

Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox sudo apt install mysql-sandbox Download the version of MySQL...

...you want to use from mysql.com: https://dev.mysql.com/downloads/file/?id=480427 Make sure to choose "Generic Linux" instead of "Ubuntu" so you get a .tar.gz instead of .deb cd into the directory...

...nested projects. Then it's really helpful! This makes use of the CDPATH variable. Similar to the PATH variable, which holds the list of directories which are searched for executables...

Then add the following to your ~/.bashrc: export CDPATH=.:~/.bookmarks/ function mark { ln -sr "$(pwd)" ~/.bookmarks/"$1" } # Always resolve symbolic links (e.g. for bookmarks) alias cd="cd -P"

...run our end-to-end tests with headless Chrome. While it's a very stable solution overall, we sometimes see the headless Chrome process freeze (or the Capybara driver losing...

...connection, we're not sure). The effect is that your test suite suddenly stops progressing without an error. You will eventually see an error after a long timeout but until...

When using custom properties in your stylesheets, you may want to set a specific property value to an existing variable in your SASS environment. A pratical example would be a...

...existing quotes, you may use the meta.inspect() function: @use "sass:meta" $my-cool-font: "Roboto", sans-serif :root --font-family-sans-serif: #{meta.inspect($my-cool-font)} Unfortunately, the output of...

amundsen.com

...but REST itself - in a nutshell. so here's a new angle i've started playing with: "REST Upside Down...

medium.com

...end up with web page bloat. But loading a webpage is much more than shipping bytes down the wire. Once the browser has downloaded our page’s scripts it then...

...dive into this phase for JavaScript, why it might be slowing down your app’s start-up & how you can fix it. The article author also tested 6000+ production sites...

...take a long time, so we only want to compile when needed. This card shows what will cause Webpacker (the Rails/Webpack integration) to compile your assets. When you run a...

While development it is recommended to boot a webpack dev server using bin/webpack-dev-server. The dev server compiles once when booted. When you access your page on localhost before...

Selenium cannot reliably control a browser when its window is not in focus, or when you accidentally interact with the browser frame. This will result in flickering tests, which are...

...tests to complete. The solution is to run Selenium inside a VNC session so the Selenium-controlled browser doesn't pop up over your main work area. Understanding issues with...