...an event handler, there are multiple methods to cancel event propagation, each with different semantics. event.preventDefault() Only prevents the default browser behavior for the click, i.e. going to a different...
...url or submitting a form. When invoked on a touchstart event, this also prevents mouse events like click to be triggered. event.stopPropagation() Prevents the event from bubbling up the DOM...
...in the context of our application. While you could roll out a custom authentication solution, this would likely expose you to the various risks of "homegrown crypto". In practice we...
...like clearance or devise for this task. Learn Read the article Rails Authentication from Scratch You don't need to do write any code, but you should be able to...
If you want to switch to another ruby versions, you have several options, depending on what you want: Do you want to switch temporarily, per project, or globally?
Unlike RVM, rbenv does not offer a command like rvm use. By default, it respects your project's .ruby-version file. If you need to change manually...
When RSpecs runs the first feature spec, you may see log output like this: Capybara starting Puma... * Version 6.5.0, codename: Sky's Version * Min threads: 0, max threads: 4
...on http://127.0.0.1:39949 You can disable this behavior by tweaking Capybara's Puma server in your spec/support/capybara.rb: Capybara.server = :puma, { Silent: true } Note You don't need to configure this...
Are My Indexes Affected? If your database has been created on an operating system with glibc version < 2.28 and later upgraded to an operating system with glibc >= 2.28, you...
...affected. To find out which indexes in our database are affected, run the following slightly modified query from the PostgreSQL documentation: CREATE extension amcheck; SELECT bt_index_check(index => c.oid...
Intel CPUs receive updates, including security relevant upgrades, through 2 channels: Firmware/UEFI BIOS updates can also update the microcode in CPUs. This is the preferred and persistent way
How to install an microcode update? If one is available and deemed sufficiently stable from Debian's or Ubuntu's perspective, the intel-microcode package is updated and...
git shortlog -s -n [commit-range] -n, --numbered Sort output according to the number of commits per author -s, --summary Suppress commit descriptions, only provide commit count [commit-range]
...tagname.. for "everything after that tag" Example output for spreewald: 60 Tobias Kraze 12 Henning Koch 7 Dominik Schöler 6 Thomas Eisenbarth 5 Martin Straub 3 Minh Hemmer...
While it might seem trivial to implement an invoice that sums up items and shows net, gross and vat totals, it actually involves a lot of rules and caveats. It...
...examples in Ruby and MySQL, the concepts apply to all programming languages and data stores. When to round There are exactly two spots where your invoice logic should round money...
...good thing. It's possible to configure this requirement at the web- or proxy server level, where nginx or apache will just redirect every request on http to https. Some...
...if the URL they've been called with contains the http or the https scheme and issue their own redirect response (usually 301 or 302) to https. This card is...
When you use method_missing to have an object return something on a method call, always make sure you also redefine respond_to_missing?. If you don't do it...
def method_missing(method_name, *args, &block) if method_name == :bark 'woof!' else super end end end This will allow you to say: Dog.new.bark => "woof!" But: Dog.new.respond_to? :bark...
Since I use this a lot in my daily work and there were no scripts working properly for me, I made one myself. It's actually not bound to Xfce...
...t tried it, though). Installation If you don't yet have xdotool, install it: sudo apt-get install xdotool If you don't yet have wmctrl, install it:
Du weißt was copy-on-write ist und warum das in Zusammenhang mit Snapshots praktisch ist Du weißt was Fragmentierung ist und wann und wo es bedeutsam ist
Du weißt wie du einen Datenträger verschlüsselst Du weißt wie man ein Linux System verschlüsselt Du weißt wie man die Systeme jeweils wieder entschlüsselt Inhalte LinuxFilesystemsExplained (Achtung alt)
You can change which branches will be pushed when saying git push. Our recommendation is to set it to current. From the git-config documentation: push.default Defines the action git...
...branch, but forgot to setup tracking. If you can't currently push, use git branch --set-upstream-to=origin/$(git branch --show-current...
Detecting if a Javascript is running under Selenium WebDriver is super-painful. It's much easier to detect the current Rails environment instead. You might be better of checking against...
...the name of the current Rails environment. To do this, store the environment name in a data-environment of your . E.g., in your application layout: <html data-environment=<%= Rails.env %>>
In RSpec you can tag examples or example groups with any tags you like simply by saying describe ReportCreator, slow: true do # .. end describe ReportCreator do it 'generates reports', slow...
# ... end end You can then only run examples with these tags. rspec --tag slow rspec -t slow # Using the parallel_tests gem rake "parallel:spec[,,--tag slow]"
This is a small example on how you can check if your Postgres index can be used by a specific query in you Rails application. For more complex execution plans...
...it might still be a good idea to use the same path of proof. 1. Identify the query your application produces query = User.order(:last_name, :created_at).to_sql
...to read the The framework field guide - Fundamentals, the first of a three part series to learn the basics of frontend technologies. I can highly suggest it for learning the...
...fundamentals. 'The framework field guide' is written by Unicron Utterances and there side has many high quality articles on web development and computer science related to programming. The Framework Field...
...measurement metrics in Linux. These are the differences: Code Name Description vsz virtual memory size Total amount of memory a process may hypothetically access. Includes swapped memory, memory from external...
...libraries and allocated memory that’s not used. rss resident set size Total amount of non-swapped used physical memory. Includes memory from external shared libraries. pss proportional share size...
Why string sorting sucks in vanilla Ruby Ruby's sort method doesn't work as expected with special characters (like German umlauts): ["Schwertner", "Schöler"].sort # => ["Schwertner", "Schöler"] # you probably expected...
...Schöler", "Schwertner"] Also numbers in strings will be sorted character by character which you probably don't want: ["1", "2", "11"].sort # => ["1", "11", "2"] # you probably expected...
Don't sum up columns with + in a sql-query if NULL-Values can be present. MySQL and PostgreSQL cannot sum up NULL values with the + value. The sum value...
MySQL: mysql> select 1 + 2 + 3; +-----------+ | 1 + 2 + 3 | +-----------+ | 6 | +-----------+ 1 row in set (0,00 sec) mysql> select 1 + NULL + 3; +--------------+ | 1 + NULL + 3 | +--------------+ | NULL...
If you need to convert an SVG source to PS or EPS, the most common suggestion on the interwebs is to use Inkscape from the commandline. Inkscape is a fairly...
...converting is CairoSVG. CairoSVG is available on most Linux distros through their package management systems, e.g. apt install cairosvg on Ubuntu. It has few dependencies (most importantly Python 3 and...
...popup on all browsers. When you integrate a date picker popup, remember to also set autocomplete="off" on the text input that opens the calendar on click. Otherwise the autocomplete...
...suggestions will cover the calendar box and make it unusable: If you are using a tool like Unpoly you might want to set autocomplete="off" in the JavaScript that also...
If the project team consists of at least 2 members, do a daily standup. It should not take much longer than 15 minutes. Format Tell everyone else
if there are new developments everyone needs to know about A "still working on X, will probably be done today" is totally fine. No need to tell...
When you have an Angular directive that transcludes content, you might want to do something in case there is no content inside your element, like showing some default content.
...you can not do something like default goes here . Angular will always empty that element's text, even if there is nothing to transclude. But you can use your directive...