...threads, that handle the incoming requests. Example: A Puma server with 2 workers and 1 thread each can handle 2 request in parallel. A third request has to wait until...

...but once one thread is blocked, another can continue. Example: A Puma server with 1 worker and 2 threads can handle 2 requests. A third request has to wait until...

...webcam in PulseAudio use the following one-liners: # Connected cards $ pactl list short cards 1 alsa_card.pci-0000_00_1f.3 module-alsa-card.c 5 alsa_card.usb-Lenovo_ThinkPad_Thunderbolt_4_Dock...

...can cause the above error, when the arc cosine of something slightly more than 1.0 is to be computed, e.g. for the (zero) distance between the same coordinates (applies only...

...fix, we just force the value we compute the arc cosine of into [-1; 1] bounds. Put this into a config/initializers/graticule_spherical_distance.rb initializer: Graticule::Distance::Spherical.class_eval do def self.distance(from...

...You still need to include rome/dist/rome.css for its basic positioning styles. rome(element, { weekStart: 1, // Monday weekdayFormat: 'short', // Mon styles: { // Picker overlay container: 'rd-container border rounded-lg shadow bg...

...form_for(@user) do |form| = form.input :email = form.submit 'Save', class: ['btn', 'btn-primary'] Option 1: Using the form.error method The form.error method renders the first error on :base.

...circle, it is then asked to compute the arc cosine of a result like 1.0000000001. Since this is undefined, MySQL correctly returns NULL (instead of the expected distance of...

...this problem is to discard rounding errors by forcing any results into bounds [-1; 1] before computing the arc cosine on it. Put the following into an initializer like config/initializers/graticule_spherical_to_sql_without_nulls.rb...

...browser process crashes on your users. Although this guide has been written for Angular 1 originally, most of the advice is relevant for all client-side JavaScript code.

link: (scope, element, attributes) -> updateTime = -> var now = new Date(); element.text(now.toString()) setInterval updateTime, 1000 The version below clears the interval and doesn't leak memory: @app.directive 'clock', -> link: (scope...

phili.pe

...rewrite legacy git aliases to make them work with differently named default branches Step 1: Decide which is the most common default branch name of your projects, e.g. master. Define...

...Task['notify:critical_operation']).to receive(:invoke) expect { described_class.clean }.to change(User, :count).from(1).to(0) end Note: Try to avoid logic in rake tasks and prefer to just...

makandra dev
tpgi.com

On the other hand – all these items are not to hard to fix. 1, 3, 4, 5, 7, 8, 9, 10 should be easy to do right, and...

...part of the web". Do not use standards in any stage before (like 2, 1 or 0). Run NODE_ENV=production rake assets:precompile to get compiled output in public/packs...

CSSnext Input: body { font-variant: small-caps; background-image: image-set(url(test_1.svg) 1x, url(test_2.svg) 2x); } Output: body { -webkit-font-feature-settings: "c2sc"; font-feature-settings: "c2sc";

...unexpectedly splat the array elements: block = proc { |a, b| "a=#{a}, b=#{b}" } block.call(1, 2) # "a=1, b=2" block.call([1, 2]) # "a=1, b=2" Note that lambdas...

...behave as expected: block = lambda { |a, b| "a=#{a}, b=#{b}" } block.call(1, 2) # "a=1, b=2" block.call([1, 2]) # ArgumentError: wrong number of arguments (1 for...

...class Article < ActiveRecord::Base named_scope :available, :conditions => { :state => [ 'unassigned', 'draft' ] } end #<Article id: 1, title: "Cooking noodles", state: "unassigned"> #<Article id: 2, title: "How to rock", state: "draft">

>> Article.available # SELECT * FROM `articles` WHERE (`articles`.`state` IN ('unassigned','draft')) => [ #<Article id: 1, title: "Cooking noodles", state: "unassigned">, #<Article id: 2, title: "How to rock", state: "draft"> ]

BANK_CODE = /\A\d{8}\z/ # Germany BANK_ACCOUNT_NUMBER = /\A\d{1,10}\z/ # Germany ZIP_CODE = /\A\d{5}\z/ # Germany HEX_COLOR = /\A([a-fA-F0...

IP_ADDRESS = /\A(?:25[0-5]|(?:2[0-4]|1\d|[1-9])?\d)(?:\.(?:25[0-5]|(?:2[0-4]|1\d|[1-9])?\d)){3}\z...

makandra dev

Option 1: JSON dump In config/webpack/environment.js you can get inspect environment which includes all webpack config options set for the current environment: const { environment } = require('@rails/webpacker') const webpack = require('webpack...

...have the content type "text/plain" And the download should contain the following lines: | Line 1 |

...filter(function() { return this.nodeType === 3; }); } Also check out this list of existing node types. 1 is HTML tag, 3 is text, 8 is comment, etc...

...for huge amounts. We recently had this issue in a project with more than 100.000 attachments, where we used a structure like this /attachments/123456789/file.pdf. Even the ls command lasted several...

...the list of possible errors that might be unexpected in the first place. Step 1: Prepare your Uploader for the new structure Implement a new structure, like described in a...

...application, you can use these few lines of CoffeeScript code: joinSentence = (array) -> if array.length > 1 array[0..-2].join(', ') + ', and ' + array[-1..] else array.join ', ' Examples: > joinSentence(['cats', 'dogs', 'pandas'])

...Here is some plain JavaScript, should you prefer that: function joinSentence(array) { if (array.length > 1) { return array.slice(0, -1).join(', ') + ', and ' + array.slice(-1); } else { return array.join...

makandra dev
select2.org

...your first request on opening the input element. The Select2 data format { "results": [ { "id": 1, "text": "Option 1" }, { "id": 2, "text": "Option 2" } ], "pagination": { "more": true } } Basic ajax options

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

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

makandra dev

...threads. Unfortunately, when you use blocking system calls (e.g. locks on the database), Ruby 1.8 threads won't work because system calls will block the whole interpreter. Luckily you can...

...ActiveRecord::Base.establish_connection(config) end it 'should synchronize processes on the same lock' do (1..20).each do |i| fork_with_new_connection do @reader.close ActiveRecord::Base.connection.reconnect! Lock.acquire('lock') do...

...your magic here end end Example structure The resulting directory structure will be: /app-root/public/system/users/avatar/000/001/... (1st record) /app-root/public/system/users/avatar/000/002/... (2nd record) ... /app-root/public/system/users/avatar/000/999/... (999th record) /app-root/public/system/users/avatar/001/000/... (1000th record) ... /app-root/public/system/users/avatar/999/999/... (999'999th record) /app-root/public/system/users/avatar/1000/000...

...1 millionth record) So if you have 500k records, you will still only have 500 directories inside /app-root/public/users/avatar/. And inside each of them, at most 1000 sub-directories.

makandra dev
innig.net

...closure-like entities? "return" returns from closure True closure? or declaring context...? Arity check? --------------- ----------------------------- ------------------- 1. block (called with yield) N declaring no 2. block (&b => f(&b) => yield) N declaring...

...Y except return declaring warn on too few 5. proc <<< alias for lambda in 1.8, Proc.new in 1.9 >>> 6. lambda Y closure yes, except arity 1 7. method Y closure...