...If you want to check your setting, do the following. By default, it will return matching (see above). $ git config --global push.default matching So to change that to push only...

relishapp.com

...error, it will fail with a not-so-helpful error message: expected present? to return true, got false (Spec::Expectations::ExpectationNotMetError) Solution That can be fixed easily. RSpec expectations allow...

...in replacement for trigger() (requires Unpoly): jQuery.fn.triggerNative = function(...args) { this.each(function() { up.emit(this, ...args) }) return this } With this you can replace a call like $element.trigger('change') with $element.triggerNative('change'). You...

if (!$event.originalEvent) { let eventProps = up.util.only($event, ...convertedPropNames) up.emit($event.target, eventName, eventProps) up.event.halt($event) } }) return this } Here is an example usage: $element.select2().enableNativeEvent('change') Make sure this function is applied...

...that dynamically composes person.firstName and person.lastName: var person = { firstName: 'Guybrush', lastName: 'Threepwood', get fullName() { return this.firstName + " " + this.lastName; }, set fullName(name) { var parts = name.split(" "); this.firstName = parts[0]; this.lastName = parts[1]; } };

...use Object.defineProperty() instead: var person = { firstName: 'Guybrush', lastName: 'Threepwood' }; Object.defineProperty(person, "fullName", { get: function() { return this.firstName + " " + this.lastName; }, set: function(name) { var parts = name.split(" "); this.firstName = parts[0]; this.lastName = parts[1]; } });

...HTTPS forwarding header, Rails recognizes that a request originally was on HTTPS and will return the correct protocol. Caveats: You need to harden your server setup to forbid the routing...

...PATH=$(find-up .nvmrc | tr -d '[:space:]') if [[ $NVM_PATH == $NVM_PATH_WAS ]]; then return fi NVM_PATH_WAS=$NVM_PATH if [[ -f "$NVM_PATH/.nvmrc" ]]; then nvm use $(<"$NVM_PATH/.nvmrc...

rubydoc.info

...of hashes, where the keys are the table headers from the first row table.headers Return only the first row table.rows Return all but the first row as an array of...

makandracards.com

...your command will reveal the issue; git on the other hand will use the return value of that call to decide if the state is good or bad.

...an element is present, without errors raised, you can use #has_css?. It will return a Boolean – but will wait as well. If the element does not exist, it will...

...take the configured Capybara.default_wait_time for this check to return false, which is usually several seconds. The solution is to disable the waiting for just that check:

When your JavaScript bundle is so massive that you cannot load it all up front, I would recommend to load...

...but includes the space character /[[:punct:]]/ Punctuation character /[[:space:]]/ Whitespace character ([[:blank:]], newline, carriage return, etc.) /[[:upper:]]/ Uppercase alphabetical /[[:xdigit:]]/ Digit allowed in a hexadecimal number (i.e., 0-9a...

makandra dev

...is no longer possible. You might want to set event.returnValue = true, as a truthy returnValue was necessary to trigger the alert in Chrome < 119 You might want to return any...

...page? Changes you made may not be saved.' event.returnValue = leaveMessage // support for Chrome < 119 return leaveMessage // support for older browsers } } window.addEventListener('beforeunload', warnBeforeUnload...

...function. Where promiseState() becomes useful is when writing unit tests for a function that returns a promise. Let's say we write a promise-based variant of setTimeout(): function setTimer...

return new Promise(resolve, reject) { setTimeout(resolve, delay) } } We would use it like this: setTimer(300).then(function() {...

Here is a test for setTimer() that uses promiseState(): describe('setTimer...

...a setter (when it gets the new value as an argument): $scope.name = function(newName) { return angular.isDefined(newName) ? (_name = newName) : _name; } You need to bind this function with ng-model and...

...angular.module('getterSetterExample', []) .controller('ExampleController', ['$scope', function($scope) { var _name = 'Brian'; $scope.user = { name: function(newName) { return angular.isDefined(newName) ? (_name = newName) : _name...

postgresql.org

Task.where("details->'a'->>'b' = ?", "value") # same as above, but via operator chaining -> returns JSON, whereas ->> returns text. Note that the key(s) must be passed with single quotes...

...this in your uploaders already. end def remove_empty_container_directory(dir = store_dir) return unless Dir.empty?(dir) Dir.delete(dir) remove_empty_container_directory(File.dirname(dir)) end end

jsfiddle.net

...e.g. for use in the client's browser: function svgUri(text) { let svg = ` ${text} ` return 'data:image/svg+xml;charset=utf8,' + window.escape(svg) } See the attached JSFiddle for an example.

developers.google.com

text: ' ', } element.addEventListener('click', (event) => { navigator.share(data) event.preventDefault() }) } If you require feedback, navigator.share will return a promise that resolves or rejects, depending on whether the sharing was completed.

makandra dev

...version_appendix(version) Versionomy.parse(version) end def self.major_version_change?(version_1, version_2) return false if version_1.blank? || version_2.blank? parse_major_version(version_1) != parse_major_version(version_2)

github.com

...on the last argument to that method, before assigning optional arguments. If to_hash returns an instance of Hash, the hash is taken as keyword arguments to that method.

...it most likely will), Ruby will raise ArgumentError. Bah. (If to_hash does not return a Hash, assignment will work as expected – but this should actually never happen.)

Usually, Unpoly compiler destructors are returned from the compiler function. However, when using async compiler functions, you can not register destructors via return. This will not work: up.compiler('my-example...

...async (element) => { await something return function onDestroy() { // ... } }) Instead, use up.destructor: up.compiler('my-example', async (element) => { await something up.destructor(element, function onDestroy() { // ... }) }) However, note that your element might be removed from...

...is probably \s. It matches the following whitespace characters: " " (space) \n (newline) \r (carriage return) \t (tab) \f (form feed/page break) However, in some cases these may not be good...

...def inline!(version) # It is recommended to watch for a feature flag, see below. return version unless Rails.config.feature_inline_email_images # `attachments` is provided by Rails, see the linked documentation...

attachments[version.url] end This helper expects a Carrierwave version as in input. It returns an object that represents the attachment and responds to the #url method. Mailer view:

github.com

...option --ignore-app-not-running and due to that the command will exit with return code 0. With the next request to your application passenger will start your application based...