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

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.

RuntimeError: can't modify frozen String /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': #stringify_keys - returns hash or session hash with keys stringified /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize' /home/user/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/pry-0.13.1/lib/pry/pry_class.rb:13:in `new...

...form = up.element.first(formSelector) element.addEventListener('click', (event) => { event.preventDefault() let linkTag = buildLinkTag(form) if (linkTag == null) return window.parent.postMessage({ mceAction: 'insertContent', content: linkTag, }); window.parent.postMessage({ mceAction: 'insertContent', content: ' ', }) window.parent.postMessage({ mceAction: 'close' }); }) function buildLinkTag(form...

...parentheses) instead of using it as a keyword import (without parentheses). The import() function returns a promise with the exported variables: let exports = await import('large-library') console.log("A named...

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

..... Your supported Ruby versions for this gem must be >= 2.3. When rake release returns an error rake aborted! Your rubygems.org credentials aren't set. Run `gem push` to set...

makandra dev

...video's initial playback time. Setting this value seeks to the new time. readyState returns a value in [0:4] indicating its state. Caveats On iOS, the video.preload attribute is...

...pattern below. Note how the class is replaced by a constructor function newDog, which returns an object that has the object's public methods as properties: function newDog(name) {

console.log(name + " is a good boy"); } } function walk(additionalMeters) { meters += additionalMeters; } function isHungry() { return meters > 50; } return { bark: bark, walk: walk } } As function isHungry() is not returned, it remains...

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

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

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

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

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)

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

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

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

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