unpoly.com

...planner.js, tooltips.js // Simple boolean flag up.compiler('[date-picker]', (element) => { const picker = flatpickr(element, { /* config */ }) return () => picker.destroy() }) // With configuration data (via up-data) up.compiler('[planner]', (container, { type, view, icons }) => { window.Planner = new...

'fish' => nil, 'birds' => '1' } ] end let(:csv) { generate_csv(csv_data) } # This will return a CSV with one header row and four data rows

stackoverflow.com

...never create a new object in an implicit conversion method. This method should either return self or not be implemented at all. Obviously, this is the reason behind this recent...

...path(path, expires_at = 2.hours.from_now, allow_fuzzy_expiry: true, secret: Rails.application.secrets.url_signature_secret) return unless path uri = URI.parse(path) if allow_fuzzy_expiry expires_at = expires_at.end_of_hour...

To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet end end This is often, but not always the same...

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

...redirect_to @movie # else # render 'new' # end render plain: params.inspect end Note that #inspect returns a human-readable representation of an object. All Ruby objects implement this. Submit the new...

...than calling other step definitions. Because you are using plain ruby, you can use return values, structured arguments (e.g. hash options), etc. I often have files like the session_steps.rb (below...

...the component. Use Jasmine spies to mock the window.fetch() method, inspect its calls and return a promise for a Response...

...in a central place makes your code DRY. E.g. Movie.human_attribute_name(:title) will return the title translation from activerecord.attributes.movie.title. Browse through the locale files of a recent sample app...

...order of test-writing and implementation is up to you. When you're done, return to writing the code. The specced thing now exists, so you can continue making that...

Class Rectangle with properties width and height. It offers an area method that returns the product of width and height. Write an average function that takes an arbitrary number...

makandra dev

config.before_send = lambda do |event, hint| log_sentry_event(event, hint) event # Return event so it can be processed by dummy DummyTransport end end Then add this helper...

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

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

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

...POST session/1230859ba100e7b2e5472cfb5bdf94c3/execute 2020-01-02 00:00:03 INFO Selenium >>> http://127.0.0.1:9538/session/1230859ba100e7b2e5472cfb5bdf94c3/execute | {"script":"return arguments[0].matches(':disabled, select:disabled *')","args":[{"ELEMENT...

makandra dev
github.com

var key = keyValuePair[0]; var value = keyValuePair[1]; pdfInfo[key] = decodeURI(value); } } return pdfInfo; } If you want to place repeated content outside the header or footer area, I...

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

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

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

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

...service redis-server restart Confirm your configuration has been updated. The following command should return "OK". redis-cli select `nproc --all...

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: