// app/webpack/spec/support/jasmine_provider.js import jasmineRequire from 'jasmine-core/lib/jasmine-core/jasmine.js' export default function getJasmineRequireObj() { return jasmineRequire; } Then expose the provider in your config/webpack/environment.js: const webpack = require('webpack') environment.plugins.prepend('Provide', new...

Returning an empty scope can come in handy, e.g. as a default object. In Rails 4 you can achieve this by calling none on your ActiveRecord model. MyModel.none # returns an...

...folders, you might consider setting this keyboard to "Copy From Repository Root". This will return the path spec/foo_spec.rb instead of foo_spec.rb. Caveat: This will not copy the line number...

...message to be set, like this: savon.expects(:action_name).with(message: { user_id: 123 }).returns(' ') If you want to stub only the returned XML and do not care about request...

...you can not omit with as Savon's helper will complain: savon.expects(:action_name).returns(' ') ^ Savon::ExpectationError: Expected a request to the :action_name operation with no message.

...run some_expensive_calculation every time you call var_value if some_expensive_calculation returns nil. This illustrates the problem: def some_expensive_calculation puts "i am off shopping bits...

...shorthand vor "nil or undefined", so if you want to cache something that can return nil, you can not use it. You will have to check for 'defined?' only, ignoring...

...as described in the documentation. For example load ace Editor like this: function loadAceEditor() { return import(/* webpackChunkName: "ace" */ 'ace-builds/src-noconflict/ace').then(() => { return import(/* webpackChunkName: "ace" */ 'ace-builds/webpack-resolver.js') }) }

...and sync any changes into the textarea. $element.hide() session.setValue($element.val()) session.on('change', () => { $element.val(session.getValue()) }) return () => { editor.destroy...

...seems also to have problems with zeitwerk, since the create statement just didn't return. Pry (binding.pry) worked without problems for me. Note: In case you are using pry-byebug...

...use .to_json instead of .iso8601 to use the build-in eq matcher: it 'returns the created at attribute of a user' do get '/users/1' expect(JSON.parse(response.body)['created_at...

The Angular 1.2 way: # By default, angular returns undefined for invalid attributes which removes # the value from the form field's ngModel (which means it's not sent to the...

...not be overwritten). # # This directive makes sure that form fields with an invalid value return an # empty string instead of undefined. for elementType in ['input', 'textarea', 'select'] @app.directive elementType, ->

...to get to a pagination page that does not exist), the database will not return a record and so you will not get the count. To work around this, I...

...of the weekday in Ruby as defined by ISO 8601, use Date#cwday, which returns values in 1..7 (mind the range difference to Date#wday). The first week of...

...the calendar week in Ruby as defined by ISO 8601, use Date#cweek, which returns values in 1..53 USA and Canada Not defined in a standard. Weeks start on...

makandra dev
select2.org

"more": true } } Basic ajax options $('#mySelect2').select2({ ajax: { url: , data: function (params) { return { query: params.term, page: params.page || 1 } } processResults: function (data, params) { return data }, } }); Further reading: https://select2.org/data-sources/ajax

...both its group and its group_id: user = User.find(1) user.group = Group.find(3) user.group # returns # user.group_id = 4 user.group_id # returns 4 user.save After the save, the change to group...

...id will be lost: user.group # returns # user.group_id # returns...

...The AJAX call is asynchronously and we don't have control over when it returns (and hence when it calls the callback function). Here is a test that does all...

We're using jasmine-ajax to mock access to the network. jasmine.Ajax.requests.mostRecent() returns the most recent AJAX request, which we can inspect for its parameters and payload. We...

docs.gitlab.com

...the same job. If you configure one job to use both keywords, the linter returns a key may not be used with rules error. GitLab 12.3 introduced rules. You can...

...to die for this code: function effectiveDeviceWidth() { var deviceWidth = window.orientation == 0 ? window.screen.width : window.screen.height; // iOS returns available pixels, Android returns pixels / pixel ratio // http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html if (navigator.userAgent.indexOf('Android') >= 0 && window.devicePixelRatio...

...deviceWidth = deviceWidth / window.devicePixelRatio; } return deviceWidth...

...instance to fill in text. Ensure everything is loaded with patiently do page.execute_script("return isCkeditorLoaded('#{selector}');").should be_true end Example The fill in text snippet for Cucumber:

...I fill in the "([^\"]+)" WYSIWYG editor with:$/ do |selector, html| patiently do page.execute_script("return isCkeditorLoaded('#{selector}');").should be_true end html.gsub!(/\n+/, "") # otherwise: unterminated string literal (Selenium::WebDriver::Error...

docs.angularjs.org

...you are using Coffeescript, it is likely to be the culprit. Since Coffeescript always returns the value of the last expression, it may return DOM nodes: # coffeescript scope.focus = -> element.focus()

...scope.focus = function() { return element.focus(); // wheee } If you e.g. use this function like this, the error will be raised:

Solution By adding an explicit return value (e.g. return false), you can...

...useful methods: URLSearchParams.append() - appends a query parameter URLSearchParams.delete() - deletes the specified query parameter URLSearchParams.get() - returns the value of the specified query parameter URLSearchParams.has() - checks if specified query parameter exists URLSearchParams.set...

...Element attribute" To access virtually anything, create a "Custom Javascript" variable. Define a function() { return ...; } that returns whatever you need. You can reference other GTM variables with {{ }}.

Previous versions of Consul exhibited strange behavior when querying a power that returns nil. Consul 0.4.2+ behaves as expected: power.notes # => returns nil power.notes? # => returns false power.notes! # => raises Consul::Powerless

...Note.last) # => returns false power.note!(Note.last) # => raises Consul::Powerless

...Sass function is computing a result that is neither assigned to a variable nor returned. Keep in mind that all functions in Sass return something, Sass does not mutate objects...

...If you don't speak CoffeeScript, take this JavaScript: this.app.decorator('$httpBackend', ['$delegate', function($delegate) { return function() { var headers = arguments[4]; var contentType = (headers != null ? headers['X-Force-Content-Type'] : void...

...if (contentType != null && headers['Content-Type'] == null) { headers['Content-Type'] = contentType; } return $delegate.apply(null, arguments...

...get: () => value, set: (newValue) => value = newValue } delete newDescriptor.value delete newDescriptor.writable Object.defineProperty(obj, prop, newDescriptor) return spyOnProperty(obj, prop, accessType...