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

...rescue ActionController::ParameterMissing {} end def note_scope # Restrict what the user may access by returning a scope with conditions. Note.all end def load_notes @notes ||= note_scope .strict_loading # Raise...

...preloaded will raise an ActiveRecord::StrictLoadingViolationError. There is a private method #note_params that returns a permitted attributes hash that can be set through the #update and #create actions.

...might think of XPath's contain() function: page.find(:xpath, ".//*[contains(text(), 'hello')") Unfortunately that returns a lot more elements than you expect:

hello ] What you need to do instead is...

...by disabling an unused compression webpackConfig.plugins = webpackConfig.plugins.filter(plugin => { const isBrotliCompression = plugin.constructor.name === 'CompressionPlugin' && plugin.options.algorithm === 'brotliCompress' return !isBrotliCompression }) Older Webpacker versions might need this instead: // Save compile time by disabling an unused...

...other onbeforeunload handlers: $(function(){ document.body.onbeforeunload = function() { for(editorName in CKEDITOR.instances) { if (CKEDITOR.instances[editorName].checkDirty()) { return "Unsaved changes present!" } } } } A robuster implementation example Note: Don't forget to mark the 'search...

...method for others which need to know for unsaved changes function isUnsavedChangeConfirmed() { if (isUnsavedChangePresent()) { return confirm(warningMessage + "\n\n" + confirmationMessage); } else { return true; } } // opens a confirmation dialog if unsaved changes...

chrisboakes.com

...JavaScript function that you can use for that: function debounce(callback, delay) { let timer return function(...args) { clearTimeout(timer) timer = setTimeout(() => { callback.apply(this, args) }, delay) } } Usage example function onScroll() { ... } window.addEventListener...

image = params.require(:gallery).require(:add_images).first uploader = Image.new.teh_image uploader.cache! image # Return the image's cache name to the client render json: uploader.cache_name end end

submitButton.removeAttr 'disabled' # Prevent unsubmittable form (dirty fix) Helper = # Clone the template row # @return: The newly created image row addImageToForm: -> row = imageTemplate.clone() Helper.increaseTemplateIndices() row.removeClass 'gallery-form--template' row.insertBefore imageTemplate...

github.com

JavaScript Create an object with no properties with Object.create(null) => {} The comma operator returns its last expression

...class Project < ActiveRecord::Base def user "foo" end belongs_to :user end Project.new.user still returns "foo". The reason for this is that what belongs_to does is actually this:

In Ruby on Rails, all objects have a useful blank? method. It returns true for nil but also for empty strings or empty arrays. There is also a universal method...

...present? which returns true for all values that are not blank?. In JavaScript you need to roll your own implementation of blank? and present?. If your application uses Unpoly you...

...match a certain criteria or not, Enumerable#partition can come in handy. # Enumerable#partition returns two arrays, # the first containing the elements of enum # for which the block evaluates to...

or if there are a lot of open session with status=Closing, which return Could not kill session: No such file or directory when you try to kill them...

github.com

...simply mock time using Timecop.travel or its respective Spreewald steps and the browser will return the same time in new Date(). If you would like to stop the time from...

gist.github.com

...document.body.append(overlay);function getElement(event){overlay.style.pointerEvents='none';var element=document.elementFromPoint(event.clientX,event.clientY);overlay.style.pointerEvents='auto';return element};document.addEventListener('mousemove',function(event){var element=getElement(event);if(!element)return;var position=element.getBoundingClientRect...

...document.body.append(overlay); function getElement(event) { overlay.style.pointerEvents = 'none'; var element = document.elementFromPoint(event.clientX, event.clientY); overlay.style.pointerEvents = 'auto'; return element; } document.addEventListener('mousemove', function(event) { var element = getElement(event); if (!element) return; var position = element.getBoundingClientRect...

...in Coffeescript...: @app.filter 'htmlSafe', ['$sce', ($sce) -> $sce.trustAsHtml ] # ...or JS: app.filter('htmlSafe', [ '$sce', function($sce) { return $sce.trustAsHtml; } ]); # Usage: This is a replacement for the ng-bind-html-unsafe directive which has...

Ändere die Konfiguration in der ConfigMap (valide Konfiguration). Du kannst beispielsweise mit return einen custom HTTP Statuscode zurückgeben. Wird die Konfiguration jetzt erfolgreich angewendet? Verwende kubectl rollout restart...

...Erstelle eine neue ConfigMap, die den gleichen Inhalt hat wie deine bisherige. Ändere den returncode nochmals auf einen neuen Wert. Editiere das Deployment und lass es die neue ConfigMap verwenden...

...will not cause problems. However, in some cases it's possible that the data returned by query that has been backed by a corrupted index would differ from a query...

...that has been backed by a correct index. It's possible that queries will return different results or the same results with different sorting after the index has been re...

...developer who just wrote it. To check its readability, a good strategy is to return after a few months. You will have forgotten the direct context, but will still be...

...and .then() do not behave the same. In particular, if a standard promise callback returns another promise, this will delay the resolution of all later promises. jQuery's then behaves...

...the response, make a second request to /bar: var promise = $.ajax('/foo').done(function() { return $.ajax('/bar'); }); Quiz: When does promise resolve? Well, if you use done, it will resolve...

...a?(String) && value.blank? - nil - else - value - end activerecord/lib/active_record/connection_adapters/column.rb + def type_cast_for_write(value) + return value unless number? + + if value == false + 0 + elsif value == true + 1 + elsif value.is_a?(String...

...achieve this by using a callback. before_initialize :set_newsletter private def set_newsletter return unless [nil, ''].include?(receive_newsletter) self.receive_newsletter = (user.role == 'customer') end Note: When using active_type...

...Our assumption is that the element is considered visible (i.e. Capybara::Selenium::ChromeNode#visible? returns true for such elements) but the Selenium driver wants to actually click the center of...

DevOps Curriculum

...die grundsätzlichen "Bestandteile" von iptables Tables Chains Rules Targets Du verstehst was drop, reject, return und accept machen. Du kennst die 4 default tables Wie kannst du dir iptables Regeln...

git name-rev --tags Note The more commonly used git describe command will return the last tag before a commit, git name-rev the next tag after the commit...