...before="2014-7-4" You can use references like "2 years 1 day 3 minutes ago" and "yesterday": git log --after="yesterday...
...return this.firstName + " " + this.lastName; }, set fullName(name) { var parts = name.split(" "); this.firstName = parts[0]; this.lastName = parts[1]; } }; The code below shows how this object can be used. Notice the absence of parentheses...
...return this.firstName + " " + this.lastName; }, set: function(name) { var parts = name.split(" "); this.firstName = parts[0]; this.lastName = parts[1]; } }); Browser compatibility Works with IE9+ and real browsers. CoffeeScript CoffeeScript doesn't support getter/setter functions...
Hardcoded solution (preferred solution when using Rails with ActiveJob/Sidekiq or Cronjobs) Dynamic solution 1. Hardcoded solution When you are sending mails from outside the request cycle, e.g. ActiveJob/Sidekiq or...
OpenAI is currently limiting the Audio generating API endpoint to text bodies with a maximum of 4096 characters.
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" find-up() { path=$(pwd) while [[ "$path" != "" && ! -e "$path/$1" ]]; do path=${path%/*} done echo "$path" } automatic-nvm-use() { NVM_PATH=$(find-up .nvmrc | tr...
...the scanf C-operation for plotting. In the most simple application plot 'file' using 1:2 just means plot the content of the first column (as x-axis) against the...
...operations or different functions such as the example from the doc: plot 'file' using 1:($2+$3) '%lf,%lf,%lf', where you reference the n-th column by $n and...
...rendering and DB query durations Good for spotting problematic endpoints The "Recent requests" screen (1 hour history) Shows individual requests Provides the full list of DB queries per request, color...
...member list | awk -F ', ' -v member="$member" '{ if ( member == $3 ){ system("etcdctl member remove " $1); system("etcdctl member add " $3 " --peer-urls=" $4); } }' On the faulty node again
...are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define RSpec::Matchers.define :be_a_multiple_of do |expected| match do |actual|
block expectations If you want to use a block expectation like expect { rand(100) }.to produce_different_results, you have to use this syntax and call supports_block_expectations...
...two useful tools for your own usage. Desktop environment pie title Desktop environment "Gnome" : 16 "i3": 2 "sway": 2 "awesome": 1 "bspwm": 1 "mate": 1 "xfce": 1 Gnome dominates (unsuprising...
...most popular i3 and the mostly i3-compatible sway. Shell pie title Shell "bash" : 14 "zsh": 6 "fish": 2 Again, "bash" dominates as the default. Popular command line tools...
...Ruby: Get started with the greatest programming language made for humans. Note that chapters 16 (RDoc), 23 (Multi Threading) and everything after chapter 27 is irrelevant for now References
...lines and paragraphs, and outputs the result. For example: $ ruby count_words.rb test.txt test.txt has 123 words test.txt has 13 lines test.txt has 4 paragraphs Hint Find out about ARGV.
...of my favorites: console.log takes many arguments E.g. console.log("Current string:", string, "Current number:", 12) Your output can have hyperlinks to Javascript objects E.g. console.log("Check out the current %o...
...of objects) to console.table(). Example: console.table(["apples", "oranges", "bananas"]) prints: (index) Values 0 "apples" 1 "oranges" 2 "bananas" Grouping output in nested, collapsible sections Great for debugging deeply nested or...
...go to File → Settings → Appearance and set the "Zoom" option to your liking, e.g. 150%. Everything (UI elements, UI font, editor fonts) should be scaled accordingly. Scaling everything manually (classic...
You can configure RubyMine to manually scale everything. 1. Increase UI size Navigate to Help → Custom VM Options. A file will open. Here, simply add the ide.ui.scale option with...
...performance issue: what do you check in the first minute? uptime dmesg | tail vmstat 1 mpstat -P ALL 1 pidstat 1 iostat -xz 1 free -m
...sar -n TCP,ETCP 1 top Also see: How to get a rough picture about a Rails project How to examine an unknown Ruby object
You should look for rows with State: LISTEN. Rows for local address 127.0.0.1 or ::1 (IPv6) can only be reached from your own PC: Netid State Recv-Q...
...Send-Q Local Address:Port Peer Address:Port Process tcp LISTEN 0 1024 127.0.0.1:3000 0.0.0.0:* users:(("ruby",pid=33985,fd=18)) Rows for local address 0.0.0.0 can be reached...
...rename the class and change the column details to fit your purpose. Run it. 1) Deliver attachments through Rails The first way is to store your Carrierwave attachments not in...
...SHA512.hexdigest("--#{Rails.env}--#{model_class_name}--#{model.id}--#{mounted_as}--#{secret}--") # 4 bit per character, so 128 bit for the full hash. Check if still appropriate! hash.slice(0, 32) end end
ü ↔ ü However, they are not the same: 'ä' == 'ä' # false 'ä'.size # 1 'ä'.size # 2 Looking at how those strings are constructed reveals what is going on...
...the Internet is sparse and not even the Geniuses at the Genius Bar are 100% sure. We found out some things and can explain the backgrounds. tl;dr: when using...
...is only possible with workarounds. Docking stations Whenever you're considering using more than 1 external display, it makes sense to consider using a Docking Station for your Laptop of...
...the error message is too meaningless to be helpful. Example: Running with gitlab-runner 16.7.0 (102c81ba) on , system ID: Resolving secrets 00:00 Preparing the "shell" executor 00:00
00:01 Running on ... Getting source from Git repository 00:00 bash: line 157: /bin/mkdir: Argument list too long Cleaning up project directory and file based variables...
...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...
1 Manuel Kallenbach 1 Andreas Robecke Alternatives There is a powerful CLI tool called git who...
it "doesn't use logical negation for include, exhibit A" do expect([1, 2, 3]).to include(3, 4, 5) end it "doesn't use logical negation for...
...include, exhibit B" do expect([1, 2, 3]).not_to include(3, 4, 5) end end Exhibit A fails with: expected [1, 2, 3] to include 4 and 5
...simple as a tuple of start and end state. const keyframes = [ { opacity: 0 }, { opacity: 1 }, ] const animation = element.animate(keyframes, { duration: 1000 }) After the animation has finished, the animation keyframes will...
...that allows you to wait for animations to finish. const animation = element.animate(keyframes, { duration: 1000 }) await animation.finished alert('animation finished!') Side note: When animations are cancelled, the promise is rejected...
In modern Rails versions you can also use ActiveRecord's pluck method. User.active.pluck(:id) => [1, 5, 23, 42] If you are plucking from the id column in particular you can...
User.active.ids => [1, 5, 23, 42] For a DISTINCT selection, use distinct on your scope (not the resulting array). Article.distinct.pluck(:state) # SELECT DISTINCT state FROM articles => ['draft', 'published']
...Use RAILS_ROOT as a placeholder for the remote Rails root directory. # * Append ` || test $? =1;` to grep calls in order to avoid exit code 1 (= "nothing found") # * To be able...