This is how you regain disk space from OpenStack instances if you are using kvm and qcow. If your instance used up all configured disk space once the disk file...
...remains big. You can end up in a situation where for example the instance use only 20GB disk space but the disk file on the server has 100GB (or even...
...an array, neither JavaScript/ES6+ nor libraries like LoDash offet that natively. Here is a simple function instead that modifies the input array in place. function moveArrayElement(array, element, offset) {
...It was what I needed, but you could easily adjust that. Check the linked StackOverflow post for more information and other implementations...
...Basic.encode_credentials for that, and put its result into the Authorization request header. Request specs For request specs, use the :header option. it 'requires authentication' do get '/' expect(response.status).to...
...username, password) get '/', header: { Authorization: encoded_credentials } expect(response.status).to eq(200) end Controller specs In controller specs, you can put then into request.env['Authorization']. it 'requires authentication' do
...of control”. A function that accepts a callback instead of a return value is saying, “Don’t call me, I’ll call you.”. Promises un-invert the inversion, cleanly separating...
...the input arguments from control flow arguments. This simplifies the use and creation of APIs, particularly variadic, REST and spread arguments. Note that promises are not a drop-in replacement...
The Interactive Advertising Bureau (IAB) is a European marketing association which has introduced a standard how advertising can be served to users in line with the General Data Protection Regulation...
...GDPR). This standard is called the TCF 2.0 (Transparency and Consent Framework). If you want to integrate any kind of advertising into a website, chances are the advertising network will...
Suppose you want to implement a publish/subscribe pattern in your Frontend application to react to data changes and events. First, you might be looking for an event emitter library.
Haml 3.1.2 displays single quotes in FormBuilder#text_ field html escaped. You may see something like that: David's Chapter Looking at the page's HTML, your field's...
If you're trying to start a cloud-init based Ubuntu VM with KVM you will suffer long boot times and confusing output on the terminal. If you want to...
...to remove cloud-init. wait until the VM boots login echo 'datasource_list: [ None ]' | sudo -s tee /etc/cloud/cloud.cfg.d/90_dpkg.cfg sudo apt-get purge cloud-init sudo rm -rf /etc/cloud/; sudo rm...
jQuery offers many different methods to move a selection through the DOM tree. These are the most important: $element.find(selector) Get the descendants of each element in the current set...
...of matched elements, filtered by a selector. Does not find the current element, even it matches. If you wanted to do that, you need to write $element.find(selector).addBack(selector...
...relaying information to input variables it's happening via environment variables. Depending on the size of the content of the variable it might exceed your OS limits. This is independent...
A possible workaround is to use a generated file to load the input instead of the env variable, e.g. # WORKAROUND # the variable my_huge_input cannot be...
Besides their default styling properties, HTML elements have a semantic meaning. For example, an h1 tag is usually styled with a larger font and bold, while it denotes "the single...
...single main content of a page nav for sets of navigation links article for independent, self-contained content section for sections like chapters, typically with a heading aside for content...
...all the world to admire. For private gems this is very bad. To make sure this cannot happen, rubygems 2.2+ allows you to restrict eligible push hosts: Gem::Specification.new 'my...
...gem', '1.0' do |s| # ... s.metadata['allowed_push_host'] = 'https://gems.my-company.example' end In case you already messed up, follow these instructions to get your gem removed. Of course, it's not...
...why it’s important to find a way to order and maintain your routes. See: Clean your Rails routes: grouping Sometimes the routes.rb grows very fast and each line adds...
...confusion to it. Maybe it is time for a new approach. The quoted article suggests to split up your routes.rb into small partials to keep it clean. For example you...
...like invoices/generated?number=123. This could be your (very careless) controller method: def generated send_file File.join(Rails.root, 'shared', 'invoices', params[:number]) end This allows your users not only to...
...files but also any files your application can read, like this: invoices/generated?number=../../../../../etc/passwd # => send_file '/etc/passwd' You do not want this. In most cases you should prefer a show...
...Linux and MacOS, they look horrible on Windows, a problem that gets worse with smaller font sizes. The culprit is something called font hinting: ... hinting is about... programming instructions that...
...hinting, causing horrible rendering for most fonts. Embedding autohinting information into font files A solution is to autohint fonts and replace the existing (bad) hinting with the autohinting information.
You may want this for things where Rationals are being used, like when subtracting Date objects from one another. What's happening? Converting a Rational to a String usually...
...does something like this: 1.8.7 > Rational(2, 3).to_s => "2/3" 1.9.3 > Rational(2, 3).to_s => "2/3" 2.0.0 > Rational(2, 3).to_s => "2/3" However, when you have a...
...all for laying out your HTML emails. Email client HTML rendering is way more scattered than browser HTML. While you might have a pretty good understanding of what features and...
...patterns you can use to support all major browsers, I doubt anyone masters this craft for HTML email clients. The only way to ensure your email looks good (acceptable, at...
If you want to expand your Areca Raid by swapping out the disks for larger ones you will need to do the following: Swap out all disks one by one...
...and wait until the syncronisation is finished in between. Reboot your server and enter the Raid Controller Configuration by pressing TAB at the right time. In the menu go the...
...Content-Type on GET request (which have a blank body), an external API may still force you to send one. Angular's $http service will strip that header when the...
...is blank. [1] This is possibly a misconception of RFC2616. Here is how to send GET requests with a Content-Type header in Angular. Example Consider this request: $http({ method...
A fantastic guide for a dilemma facing any web-based product. Here’s a simple set of Yes/No questions that you can quickly answer before you add another item to...
...your product roadmap. Saying yes to a feature request – whether it’s a to an existing customer, a product enquiry, a teammate, or a manager – is immediately rewarding. It’s...
Soon after having written our shell-for script, we wanted to easily get dumps of our productions machines, too. This is how we do it: dump-for staging [-s]
...dump to your project's tmp directory and name it according to the capistrano stage you're calling for, here: staging.dump. When you pass the optional -s option, the dump...
What are Google’s plans for turning WebM into a genuinely open standard, one that is based on consensus like the rest of W3C’s HTML5 effort? Would Google fully...
...support such an effort? Even the WebM project’s domain is controlled by Google. Google chose to release WebM under the Creative Commons license which would theoretically allow a standards...
...common providers like the AWS one can quickly add up to a lot of storage space wasted. Each root module will download a copy of the same provider file. The...
...AWS provider is over 200 MB in size. To avoid creating multiple copies of the same file, you can use the Terraform Plugin Cache. Configuring the plugin cache:
...Railses. Consul now uses Memoizer for this. Temporarily change the current power When you set Power.current to a power in an RSpec example, you must remember to nilify it afterwards...
...Otherwise other examples will see your global changes. A better way is to use the .with_power method to change the current power for the duration of a block: