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

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

...there is no built-in method -- you can add one, however: RegExp.escape = function(string) { return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') }; You can now say: var hostname = 'makandra.com'; new RegExp(RegExp.escape(hostname)); # => /makandra\.com...

...controller (maybe application controller is also fine): If you are in the test suite return a text with the name of the file. Otherwise super. Read the browser downloads folder...

selection = role_select.node.search(".//option[@selected = 'selected']") Why is this stupid? Because #node returns the internal node representation used by the driver, e.g. instances Nokogiri::XML::Element if you...

gist.github.com

level1: level2: 'value' value = NestedHash.read hash, 'level1' expect(value).toEqual level2: 'value' it 'returns undefined when any of the keys is missing', -> value = NestedHash.read {}, 'foo', 'bar' expect(value).not.toBeDefined...

github.com

...orphan_strategy The current implementation of this method does not add any errors or return false to prevent destruction -- it either raises an exception (for restrict) or destroys or moves...

...base color and transparency value for you. @function rgba-to-rgb($rgba, $background: #fff) @return mix(rgb(red($rgba), green($rgba), blue($rgba)), $background, alpha($rgba) * 100%)

...attributes on that collection. This is simply because of the way _.without works: It returns a new array with all elements except the removed one. Unfortunately, restangular collections are not...

...meant only for collections, you probably still want something like isBlank or isPresent that return true/false for objects humans would normally consider blank or present. Here is some CoffeeScript that...

...for pseudo elements. let style = window.getComputedStyle(element, '::before') let color = style.getPropertyValue('background-color') The returned color will be a string with a color value like "rgb(253, 126, 20)".

let hexColor = rgbColor .match(/(\d+), (\d+), (\d+)/) .slice(1, 4) .map((number) => { return Number(number).toString(16).padStart(2, '0') }) .join('') .replace(/^/, '#') Ruby My use case was comparing...

...AlphaSSL CA - G2 verify error:num=20:unable to get local issuer certificate verify return:0 --- Certificate chain 0 s:/C=DE/OU=Domain Control Validated/CN=www.projecthero.com i:/O=AlphaSSL/CN=AlphaSSL...

...cucumber_paths, 'r').each do |line| lines << line.slice(/\s+when /^?([^$]*)$?/[im]?$/, 1) # @param 1: return first matched group end paths = lines.compact.sort TextMate::UI.complete(paths, :extra_chars => " ") else %x{ "$DIALOG" tooltip...

...correct (a year is almost never exactly 365 days), even 1.year.to_f won't return a result that would justify always using floats: 31557600.0 is just the same as 365.days.to...

...pattern, and options for its switches. >> regexp.source => "^f(o+)!" >> regexp.options => 5 Note that options returns a bitmask. If necessary, you could compare that to Regexp's switch constants: >> regexp.options & Regexp...

makandra dev
github.com

...urls) it works as a drop-in-replacement. It basically overwrites #to_param to return the slug, and .find to search by the slug. Make sure, everywhere you build paths...