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

...performance optimizations Removing an enum value that exists on records will make their getter return nil Neat features the generated instance methods, prefix/suffix options and scopes

...name is missing' end context 'when admin' do before { … } describe '#last_action' do it 'returns the last action performed by the user' it 'is nil for a new user'

...good habit to always end a composed matcher in true to ensure that it returns a truthy value. E.g. by using a condition as the last expression you may otherwise...

timer = Capybara::Helpers.timer(expire_in: seconds) loop do prev_size = size sleep 0.025 return res if prev_size == size break if timer.expired? end raise Capybara::WindowError, "Window size not...

an underlying Net::HTTP result, e.g. Net::HTTPUnprocessableEntity The called method will then return the return statement of the block. So this will just return the response object of...

makandra Curriculum

...can temporarily suspend a running vim editor, take a look around the system, then return to your vim editor. File ownership Understand access rights and ownership of files:

...hash_including( id: 1, thread: {id: 1} ) ) end end The example will fail and returns a not very helpful error message: expected {:id => 1, :name => "Foo", :thread => {:id => 1, :title...

...to write [\s\S]or (.|\s) to match any character including line feeds, carriage returns, etc. There's a TC39 proposal that's stuck in Stage 1. While there is...

...to set the Sass options. Webpacker const sassLoaderConfig = environment.loaders.get('sass') const sassLoaderIndex = sassLoaderConfig.use.findIndex(config => { return config.loader === 'sass-loader' }) // Disable deprecation warnings inside dependencies sassLoaderConfig.use[sassLoaderIndex].options.sassOptions.quietDeps = true sassLoaderConfig.use[sassLoaderIndex].options.sassOptions.silenceDeprecations...

...where you can specify a lambda to adjust its verification response. Your callback must return either true or false and OpenSSL's verification result is the first callback block argument...

regular-expressions.info

...the qualifier. Reads like "greedy without backtracking" – *+ and ++ try to match everything but immediately return if it doesn't succeed, i.e. /\d++/ matches 333 whereas /\d++3/ does not. (A...

...to shuffle an array randomly and a class that uses shuffle within the constructor. returnValue & returnValues it('shuffles the array', () => { spyOn(Random, 'shuffle').and.returnValue([3, 2, 1])

...If you have several new classes created in one test you could also use returnValues for any call of the method Random.shuffle. callFake If you are testing the class in...

...pool has a "reaper thread" that periodically looks for connections from inactive threads and returns them to the pool. By default the reaper runs once every 60 seconds. You can...

Will the pool ever close an unused connection? A released connection will be returned to the pool, but not disconnect from the database server. The connection will remain connected...

...not raise an exception. Instead, full_name will simply be nil, and salutation('Bob') returns 'Hi '. The same would happen in an else branch: def salutation(first_name, last_name...

...queue sizes, last run of Sidekiq) your application should have a monitoring route which returns a json looking like this: { "sidekiq": { "totals": { "failed": 343938, "processed": 117649167 }, "recent_history": {

...have this use case in tests. Example Time.parse('2020-08-09 00:00') will return different results e.g. 2020-08-09 00:00:00 +0200 depending on the Rails timezone...

...want to have the given time in UTC because that's what the API returns. it 'returns a valid API response', vcr: true do expect(client.get('/users/1')).to have_attributes...

apidock.com

...reflect on the class of an instance, e.g. to decide which partial to render: Returns an instance of the specified klass with the attributes of the current record. This is...

...carefully checked. In particular you will need to clean up a lot of unnecessary return statements...

# of all files in app/. Files cannot change in tests, so we immediately # return if we have compiled before. if test? if @compiled_before return true else @compiled_before...

adobe.com

...fscommand function to call a Javascript function with a fixed name from Javascript. In return Javascript can sort of communicate with ActionScript by calling SetVariable(name, value) on the Flash...

stackoverflow.com

...a method's source location Ruby 1.9 adds a method Method#source_location that returns file and line number where that method is defined. class Example; def method() end; end...

stackoverflow.com

Some browsers define window.event, which will return a copy of the "current" event. However, this is not defined by the W3C. Most importantly, Firefox does not support it, neither do...

makandra dev

...module_function def redis_url "redis://localhost:#{port}/#{db_number}" end def db_number # Returns a number between 2 and n. # Redis db#1 is used for development.