Consider you have a website vhost listening to www.example.com, redirecting all incoming requests that do not talk about the configured...

...var container = $.find('.container', document.body)[0]; var openTasks = $.find('.task.open', container); Note that Sizzle returns vanilla DOM nodes in a vanilla Javascript array. It does not return jQuery collections...

...child of the element we're checking var candidateFromPoint = $(elementFromPoint).closest(elementFromSelector).get(0); return elementFromSelector == candidateFromPoint; JS is_top_element = page.execute_script(js) expect(is_top_element).to eq...

...for(locator) method, which takes a prose locator like "the very important notice" and returns a CSS selector like .very-important-notice. If you are using Spreewald, this method is...

...requests for every page. The browser will first request /foo, then the server will return a redirect to /foo/ (mind the trailing slash), then the browser makes a second request...

...by configuring your static web server. What we want is: Accessing /foo should directly return the content of /foo/index.html without a redirect Accessing /foo/ should redirect to the canonical /foo...

...Laden von Models passieren # search_spec.rb describe Search, search: true do # enable indexing # ... it 'only returns posts for a post query' do post = create(:post) create(:event) Post.search_index.refresh # force index to...

angular-tips.com

...app.factory('name', someFunction) someFunction is called when the name service is instantiated and should return an object Service just like Factory, but: instead of a funciton, it receives a Javascript...

^ app.config(function($provide) { $provide.decorator('serviceToBeDecorated', function($delegate) { // modify $delegate by adding functions etc. return $delegate; }); }); More differences | | Factory | Service | Value | Constant | Provider | | can have dependencies | yes | yes | no | no...

edgeapi.rubyonrails.org

# or b.label(class: "my-#{ b.object.class.name.parameterize }", 'data-value': b.value) { b.check_box + b.text } end The return values of each call will be joined and returned. You may of course render HTML...

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

...for RSpec users: |---------------------------------------------------------| | RSpec | Mocha | |---------------------------------------------------------| | obj = double() | obj = mock() | | obj.stub(:method => 'value') | obj.stubs(:method).returns('value') | | obj.should_receive(:method).with('argument').and_return('value') | obj.expects(:method).with('argument').returns('value...

makandra dev

...below gives you just that. // Call with two desired values at two different widths. // Returns a calc() expression that will scale proportionally between those two. // Example: // Spacing should be 15px...

$width2 * $relative + $static = $spacing2 $relative: ($spacing2 - $spacing1) / ($width2 - $width1) $static: $spacing1 - ($width1 * $relative) @return calc(#{$relative * 100%} + #{$static * 1px...

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

...the element "([^\"]+)" should( not)? have scrollbars$/ do |selector, no_scrollbars| scroll_height = page.execute_script("return $('#{selector}').get(0).scrollHeight;") offset_height = page.execute_script("return $('#{selector}').get(0).offsetHeight;") comparison = no...

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

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

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

...is some plain JavaScript, should you prefer that: function joinSentence(array) { if (array.length > 1) { return array.slice(0, -1).join(', ') + ', and ' + array.slice(-1); } else { return array.join...

...extra attribute) you might run into trouble when submitting the form by pressing the return key in a field. When nothing fancy like a tabindex is defined it seems as...

...submit element inside a form is chosen (and has its attributes submitted) when pressing return.\ So, if possible, put your "default" (aka least harmful) submit element before others.

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

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