ls -1tr * | tail -1 Used switches The -1 switch makes ls return 1 file per line, -t orders by modification time and -r causes sorting from oldest...

...to newest. tail -1 then returns the last line, containing the newest file's name. If you require only a subset of files, adjust the "*" mask accordingly or use other...

...can use Hash#key. It's available in Ruby 1.9+. Hash#key(value) → key # => Returns the key of the first occurrence of a given value. If the value is not...

...found, returns nil. hash = { "a" => 100, "b" => 200, "c" => 300, "d" => 300 } hash.key(200) #=> "b" hash.key(300) #=> "c" hash.key(999) #=> nil

...directly from the database and create GIDs from them. # Note that we do not return GlobalID objects, but GID URI strings. columns = [primary_key] columns << inheritance_column if column_names.include?(inheritance...

Enumerable#count can do three things. With no argument provided, it returns the number of items. With an argument, it returns the number of items matching the given value.

makandra dev
stackoverflow.com

..and prefer CSS, you may rewrite it: field.ancestor('div.form-group') Both versions will return the outermost matching element. Use the #order option find the closest parent: field.ancestor('div.form-group...

...d even like to patch Prototype so it behaves like jQuery: Element.addMethods({ visible: function() { return offsetWidth > 0 && offsetHeight...

SELECT enum_range(NULL::portal) # Returns an array of all possible values SELECT unnest(enum_range(NULL::portal)) # Unnests the array and returns a row for each value Whereas portal...

...actually keeps a list of custom identifiers. Other identifiers will not work and simply return nil. >> Time.zone_offset('BST') => nil >> Time.zone_offset('Berlin') => nil I'm confident there are other...

...walk = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, null, false) let nextNode while (nextNode = walk.nextNode()) { textNodes.push(nextNode) } return textNodes } keys.forEach((key) => { let nodes = textNodes(element) nodes.forEach((node) => { node.textContent = node.textContent.replace(new RegExp(key, 'gi...

and focused.instance == "sun-awt-X11-XDialogPeer" and c.instance == "sun-awt-X11-XFramePeer" then return end if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and awful.client.focus.filter(c) then client.focus = c end end)

skorks.com

...dove into another shell (e.g. with sudo su username) you will close it and return to the previous one. !! Repeat the previous command. Can be used inside other commands, e.g...

...with a very old version of Bundler. For reasons unknown, the Bundler dependency API returns different dependencies for some gems (like ruby-debug or rainpress) than the dependencies found in...

...OF_TEST_PACKETS $TARGET status=$? if [ $status -ne 0 ]; then mail_traceroute $TARGET fi return $status } function mail_traceroute { MTR_OUTPUT=$(mtr -n -r $@) HOSTNAME=$(hostname -f) mail -s "Monitoring...

...link or a press a button on a Selenium-controlled browser, the call will return control to your test before the next page is loaded. This can lead to concurrency...

github.com

code: | 15 | def type_cast_from_database(value) 5811 (5.4%) / 5811 (5.4%) | 16 | return if value.nil? 1661 (1.5%) / 1661 (1.5%) | 17 | value.to_i | 18 | end

...is a string containing a regular expression fragment ("OPTIMIZE|FIXME|TODO") and needs to return a regular expression that matches comments in the given file type. If you have other...

...check whether a secure connection is used: SHOW STATUS LIKE '%ssl_ciph%'; It should return something like this | Variable_name | Value | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Ssl_cipher | AES256-SHA | | Ssl_cipher_list | AES256-SHA...

makandra dev

width: auto; display: none; border: none; margin: 0; } Javascript ;(function($) { $.fn.fixHeader = function() { return this.each(function() { var $table = $(this), $t_fixed; function init() { $t_fixed = $table.clone(); $t_fixed.find('tbody').remove...

...users WHERE sites.user_id = sites.id AND users.name = 'Bruce' It now uses these IDs to return a new scope that has no joins and a single condition on the id column...

...You can query such an power as always: power = Power.new(@user) power.updatable_post?(Post.last) # return true if the author of the post is @user power.updatable_post!(Post.last) # raises Consul::Powerless...

...the arc cosine of a result like 1.0000000001. Since this is undefined, MySQL correctly returns NULL (instead of the expected distance of 0 for the circle's center).

makandra dev

...by CSS selector .find(selector) one: .querySelector(selector), many: .querySelectorAll(selector) Test an element (returns boolean) .is(selector) .matches(selector) Test for class presence (boolean) .hasClass(class) .classList.contains(class)

...content").first.title # => ActiveRecord::MissingAttributeError The only exception from this is the id attribute which returns nil when you try to access it and did not select it.

pragdave.pragprog.com

...put the smarts back on the server. They invent new URLs which (for example) return a resource, but return it all wrapped up in the HTML needed to display it...