makandra dev

...on hover, the following SASS is used (shorthand syntax): .element color: red transition: color .1s &:hover color: green This tells the browser "whenever the color of an .element changes, let...

...it take 1/10th of a second" and next "whenever an .element is hovered, make its text green". Multiple animated properties are comma-separated: .element color: red opacity: .9 transition: color...

...effect that you can not configure Psych#dump to only write safe data. Pitfall 1: Psych::DisallowedClass Psych#safe_load only whitelists the following classes: TrueClass, FalseClass, NilClass, Numeric, String...

...optimize the result. time = Time.now data = {foo: time, bar: time}.to_yaml => => "---\n:foo: &1 2019-11-08 11:28:34.834180510 +01:00\n:bar: *1\n" ::YAML.safe_load(data...

stackoverflow.com

...Explicit conversion Explicit conversion happens when requesting it, e.g. with the splat operator: args = [1,2,3] some_method(*args) # Ruby calls args.to_a here Implicit conversion Implicit conversion happens...

uri = URI.parse(path) if allow_fuzzy_expiry expires_at = expires_at.end_of_hour + 1 end timestamp = expires_at.localtime.strftime('%Y%m%d%H%M%S') # this is similar to an hmac...

...Ruby 2.7 introduced a method for this exact purpose: filter_map. So instead of >> [1, 2, 3, 4, 5, 6].map { |i| i * 2 if i.even? }.compact

>> [1, 2, 3, 4, 5, 6].select(&:even?).map { |i| i * 2 } => [4, 8, 12] you can just do >> [1, 2, 3, 4, 5, 6].filter_map { |i| i...

developer.mozilla.org

...seems to be Baseline for all browsers since 2022). const fadeIn = [{ opacity: 0 }, { opacity: 1 }] // this is a keyframe example const container = document.querySelector('.animate-me') const animation = container.animate(fadeIn...

github.com

...not a Slack admin Find a Slack workspace admin and have them do steps 1-5 for you. You need to tell them your channel name and send a link...

manpages.ubuntu.com

...run-this-one is exactly like run-one, except that it will use pgrep(1) and kill(1) to find and kill any running processes owned by the user

makandra dev

...log --oneline | fzf --prompt 'Select the first commit you want to move' | awk '{print $1}') branch=$(git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ | fzf --prompt 'Select the...

...branch to rebase onto' | awk '{print $1}') test_command="git rebase -i --onto $branch $commit~" read -p "Execute command '$test_command' (Y/n)? " choice case "$choice" in n|N ) echo "aborted...

...use permit (or expect) to receive Strong Parameters, but strip extra parameters. # Better (option 1) redirect_to users_path(params.slice(:query, :encoding).permit(:query, :encoding)) # Better (option 2)

...xargs grep -cE "^inotify" | column -t -s: You will get a list like: /proc/3753/fdinfo/7 1 /proc/3774/fdinfo/7 1 /proc/4034/fdinfo/12 14 /proc/4839/fdinfo/11 7 /proc/4871/fdinfo/12 98 /proc/50565/fdinfo/10 3 /proc/50565/fdinfo/14 266 /proc/50565/fdinfo/25 186 /proc/50620/fdinfo/19...

/proc/5192/fdinfo/3 47697 /proc/5225/fdinfo/63 4 /proc/5274/fdinfo/23 3 /proc/6121/fdinfo/7 38 (...) The number between /proc/ and /fdinfo/ is the PID of the process and the last number is the number of inotify...

makandra dev
github.com

...Rails App with a core model (class FatModel) that has many (30) attributes and 100k records (totaling 500MB of data) in the corresponding PostgreSQL table An API endpoint /fat_models/index.json renders...

...to be very slow Measurements (N=20) showed that it takes an average of 10 seconds to render The log output already suggests an optimizable SQL query, view rendering time...

...certificate for localhost, you can use the following command. openssl req \ -x509 \ -nodes \ -days 10000 \ -newkey rsa:2048 \ -keyout development.key \ -out development.crt \ -subj "/CN=localhost" This generates a development.crt certificate...

...file and development.key key file. Note that the certificate will be valid for 10000 days, just because we don't want to do this again in a month or a...

...new style 'Delete %{count} users?' -- When using VIM you can use this command: :%s/{{\([^\}]*\)}}/%{\1}/cg Fix deprecation warnings with :overwrite_params Run tests Deploy See the commit log for...

...Fixes several serious vulnerabilities. Step-by-step upgrade instructions: Upgrade json gem to atleast 1.7.7, 1.6.8, or 1.5.5 Upgrade rails gem Change your environment.rb so it says RAILS_GEM_VERSION...

...allowing you to keep your integration tests as DRY as your application code. Option 1: Call other step definitions This is Cucumbers default way of sharing short setup steps or...

...rd|th) (role|showtime) fields?\z/ ".nested-fields .nested-fields--form:nth-of-type(#{$1})" end end end World(HtmlSelectorsHelpers) nth-of-type matches by counting the actual HTML-tag...

Scenario: Example scenario Given ... When I fill in "Character" with "Kaiser" within the 1st role fields And I select "Moon" from "Movie" within the 1st role fields

...logs the error ActionController::UnpermittedParameters in development + test and do nothing in production. Option 1: In case you use action_on_unpermitted_parameters = :raise for all environments, you might notice...

...card contains some advice that has helped me to use icon fonts more comfortably. 1 Map the font's icon names into your application domain You don't want to...

...repeat a 100 times that the icon for a "post" is actually icon-comment-alt, or that cancel buttons should be decorated with icon-remove because the shape fits so...

...use to create great-looking screen designers when you're not a designer. Part 1 contains: Light comes from the sky Black and white first Double your whitespace

...progress(title = 'Progress') total = count.to_f each_with_index do |item, index| progress = (index + 1) / total * 100 printf("#{title}: %.2f%%\r", progress) yield item end puts "#{title} is done."

Cookies without an expiration timestamp are called "session cookies". [1] They should only be kept until the end of the browsing session. However, when Chrome or Firefox are configured to...

...for quite a while now and it seems they won't change their mind. [1] We are not talking about the the Rails session cookie here, though it often is...

...matched until Capybara 2 which used to "squish" text prior to the comparison. # Capyabara 1 or 2 page.find('.haystack', text: "Hi! Try to match me.") => #<Capybara::Node::Element tag="div...

apidock.com

end end end end Output: == AddUserToken: migrating ========================================= # ... == AddUserToken: now generating tokens ============================= -- For users #1 to #500 -> 1.542s -> 1 rows == AddUserToken: migrated (1.0003s...

...complement for opacity. Just transition both of them: opacity: 0 visibility: hidden transition: all 100ms &.-visible opacity: 1 visibility: visible When fading in, visibility will immediately be set to visible...