...of some other major changes has_content? doesn't match hidden elements body now returns the unmodified source Node#wait_until and Session#wait_until have been removed. => Alternative: Node...
Some modern Javascript APIs return iterators instead of arrays. In plain Javascript you can loop through an iterator using for...of: var iterator = ...; for (var value of iterator) { console.log(value...
...var offset = $(hash).offset(); if (offset) { $('html, body').animate({ scrollTop: offset.top }, 'slow'); location.hash = hash; return false; } }); Note that this could basically work for any element whose offset() you can read...
...moored Moored (anchored) mine. --drifting Drifting mine. In Ruby ^ Docopt::docopt(the_above_doc) # returns: {"ship"=>true, "new"=>false, " "=>["Guardian"], "move"=>true, " "=>"100", " "=>"150", "--speed"=>"15", "shoot"=>false, "mine"=>false...
...using plain Ruby: "foo=3Dbar".unpack('M')[0] # => "foo=bar" Note that unpack will return an array. Our result is the 1st item. Encode a string as Quoted Printable
$children = $container.children() if $children.length == 0 $container else $lastChild = $children.last() $lastContent = $container.contents().filter(-> # Only return nodes that are either elements or non-empty text nodes @nodeType == 1 || (@nodeType == 3 && _.strip...
...validate which uses Nokogiri to validate an XML document against an XSD schema. It returns an array of Nokogiri::XML::SyntaxError objects. require 'rubygems' gem 'nokogiri' require 'nokogiri'
...set-hue($color, $target-hue) $current-hue: hue($color) $degrees: $target-hue - $current-hue @return adjust-color($color, $hue: $degrees) It now works as expected: adjust-hue(#ffff00, 120)
...t care about any callbacks or validations. Note that create_without_callbacks does not return the object, so you might want to do record = Record.new.tap(&:create_without_callbacks)
...on that, just because CookieJar#to_hash is inherited from Hash and will just return self. Bummer. You need to do it yourself, for example by using collect_hash:
+-----+------+------+ | 30 | 20 | 10 | | 30 | NULL | NULL | +-----+------+------+ Solve this by using IFNULL: it returns the selected value if present and a given alternative if it would select NULL:
...create a new object. Because of this, comparing two jQuery collections with == will never return true, even when they are wrapping the same native DOM elements: $('body') == $('body') // false
...IMAP, send the following string (incl. "01"!): 01 LOGIN user@domani.io $password The server should return something like: * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR ... 01 OK Logged in To log out, send...
touch -t `date +%m%d0000` /tmp/$$ find . -cnewer /tmp/$$ Note that $$ returns the current bash's PID so you will get some file like /tmp/12345 that stays...
...then each element of the page is represented by a method that, when called, returns a reference to that element that can then be acted upon (clicked, set text value...
Edge Rider gives your relations a method #origin_class that returns the class the relation is based on. This is useful e.g. to perform unscoped record look-up. Post.recent.origin_class...
if (str.length > 0) { str = str.replace(/\n\n+/g, ' '); str = str.replace(/\n/g, ' '); str = ' ' + str + ' '; } return str; } Unlike the Rails helper, this does not preserve whitespace. You probably don't care...
...side effect of that feature is that when you use the back button to return to the form, the submit button will be greyed out and disabled.
...it behaves very similar. The only difference is in handling of false, as false.andand.class returns false (intercepts invocation), whereas false&.class permits the invocation. &. might also remind you of Rails...
...a jQuery fallback for browsers that don't speak HTML5: var Autofocus = { supported: function() { return 'autofocus' in document.createElement('input'); }, fake: function() { $('[autofocus]').focus(); }, extend: function() { Autofocus.supported() || Autofocus.fake(); } }; $(Autofocus.extend...
If you are using Rails or ActiveSupport, calling step without a block will return an array of matching elements:
...distracting Text Selection: // from: http://stackoverflow.com/questions/1794220/how-to-disable-mobilesafari-auto-selection $.fn.extend({ disableSelection : function() { this.each(function() { this.onselectstart = function() { return false; }; this.unselectable = "on"; $(this).css('-moz-user-select', 'none'); $(this).css('-webkit-user-select', 'none...
...simply overwrite the deliver! method like this: # In your mailer.rb def deliver!(mail = @mail) return false if (recipients.nil? || recipients.empty?) && (cc.nil? || cc.empty?) && (bcc.nil? || bcc.empty?) super
...WHERE (users.id IN (899,1084,1095,100,2424,2429,2420)) the order of the returned records is undefined. To force the query to return the records in a given order...