makandra dev
dev.mensfeld.pl

...attrs.fetch_values :name, :email Hash#to_proc Turns a Hash into a Proc that returns the corresponding value when called with a key. May be useful with enumerators like #map...

...part of the implementation that lives in Javascript, implement a Search.match(query) method that returns a promise. You should be able to use it like this: var query = // ...

...API so the client requests a JSON document instead of a HTML snippet. The returned JSON could look like this: { 'results': [ { 'title': 'Sunshine', 'year': 2007, 'detailsURL': '/movies/4012' }, { 'title': 'Before Sunset...

...sure to do it this way: params.to_hash.symbolize_keys.merge(:include => { :user => :avatar }) (Note that params.to_hash returns a hash with string keys...

...src attribute. To overcome this, use the trick below. Background The ngSrc directive explicitly returns when the attribute value is falsy. As a workaround, set a "blank" image src when...

class Foo include Memoizer memoize def bar ... end end This is because def returns the method name as a symbol in...

...point to another window last_handle = page.driver.browser.window_handles.last page.driver.browser.switch_to.window(last_handle) Mind these: find_window returns a window handle, which is something like "{485fa8bd-fa99-4c26-9edc-97fed060036f}". If you already...

makandra dev
github.com

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

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

docopt.org

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

makandra Operations

You should see the details about the SMTP connection. You can return to your shell with Ctrl+c

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

makandra dev

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

makandra dev
github.com

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

...disabled that functionality and tidy up the previous original ourselves. def remove_stale_original(*) return unless original? current_original = path stale_originals = Dir[path.chomp(File.extname(current_original)) + '.*'] # Same filename, any...