Option 1: Creating a self-signed certificate with the openssl binary As igalic commented on this gist. openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout server.key...

github.com

class User < ActiveRecord::Base ... end class SignUp < ActiveType::Record[User] ... end user = User.find(1) sign_up = ActiveType.cast(user, SignUp) sign_up.is_a?(SignUp) # => true This is basically like ActiveRecord#becomes...

...entire relation (scope) to a relation of an ActiveType::Record: adult_users = User.where('age >= 18') adult_sign_ups = ActiveType.cast(adult_users, SignUp) sign_up = adult_sign_ups.find(1) sign_up.is_a?(SignUp) # => true

cookies_jar = ActionDispatch::Cookies::CookieJar.build(request, cookies.to_hash) cookies_jar.signed[:user_id] = 1 cookes[:user_id] = cookies_jar[:user_id] get "/movies/#{user_id}/favorite" Example: describe '/movies...

...console with other request like from ActionCable. Then just set the max threads to 1 and the other requests have to wait. WORKER_TIMEOUT=1000 puma -t 0:1 -w...

...1 -p...

...start the initialization with this command once booted into proxmox: # cli64 vsf modify vol=1 capacity=12000 # to 12000 GB for example Now the volume will initialize the extra space...

...watch it with the command line client: # watch -n 5 "cli64 vsf info vol=1" Note Initializing SSD's does not take any time. For HDDs the above command should...

github.com

...super, initialize might be hit with this error: ArgumentError: Wrong number of arguments (given 1, expected 0) Further readings https://github.com/makandra/active_type#activetypeobject

Easiest Way to Pick UI Colors 7 Rules for Creating Gorgeous UI (Part 1) 7 Rules for Creating Gorgeous UI (Part 2) Visual design rules you can safely follow...

...feeds, carriage returns, etc. There's a TC39 proposal that's stuck in Stage 1. While there is a /m modifier in Javascript, it only changes the meaning of ^ and...

...a selector. For example: .container .foo %span.my-selector .bar %div.my-selector .container > *:nth-child(1 of .my-selector) color: red Here, you specifically target the first element with the .my...

...grab the nth element of a certain type/tag. Browser Support https://caniuse.com/mdn-css_selectors_nth-last-child_of_syntax Chrome/Edge 111+ Firefox 113+ Safari 9+ Finding the last child matching a selector There is :nth-last...

...than it is to explain why your application does not need secure cookies. Option 1: ActionDispatch::SSL middleware You can use the ActionDispatch::SSL middleware to automatically set the secure...

subject { 'foo' } it_behaves_like 'string equaling another string', 'foo' end RSpec 1 Use it_should_act_like from our spec_candy.rb (note the /behave/act/). It allows you to...

makandra Curriculum

...commit messages, they are only kept short here to fit inside the visualization. Exercise 1: Split up the most recent commit Head over to https://code.makandra.de/makandra/advanced-git-example-project and fork the...

makandra dev

``` def foo "hello!" end ``` def foo "hello!" end Lists * Bullet list item 1 * Bullet list item 2 Bullet list item 1 Bullet list item 2

...use + or - instead of *. 1. Numbered list item 2. Numbered list item 42. You don't need to number properly Numbered list item Numbered list item You don't need...

stackoverflow.com

...def method_missing(method, *args, &block) if method.to_s =~ /play_(\w+)/ puts "Here's #{$1}" else super end end def respond_to?(method, *) method.to_s =~ /play_(\w+)/ || super end

...production, since that's what's deployed. We want to delete images older than 10 days, except if they're deployed to production { "rules": [ { "rulePriority": 1, "description": "Keep image tagged...

"selection": { "tagPrefixList": ["production"], "tagStatus": "tagged", "countType": "imageCountMoreThan", "countNumber": 9999 }, "action": { "type": "expire" } }, { "rulePriority": 10, "description": "Expire tagged images older than 10 days", "selection": { "tagPrefixList": [ "history" ], "tagStatus": "tagged", "countType": "sinceImagePushed...

...monitoring route which returns a json looking like this: { "sidekiq": { "totals": { "failed": 343938, "processed": 117649167 }, "recent_history": { "failed": { "2016-11-06": 1...

} }, "queue_sizes": { "dead": 0, "retries": 0, "monitoring": 0, "low_priority": 0, "mails": 0, "default": 0, "elasticsearch": 0, "high_priority": 0, "file_upload": 0, "scheduled": 0 }, "active_workers": 0 },

...Fetching strscan-3.0.3.gem Building native extensions. This could take a while... Successfully installed strscan-3.0.3 1 gem installed gem list strscan *** LOCAL GEMS *** strscan (3.0.3, default: 3.0.1) Therefore is may happen...

...network cards, try and match the driver to the interface name: $ ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default...

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eno1np0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode...

...local database, transfer it to a server and import it in the server database. 1. export def dump_to_file(list) content = Base64.encode64(Marshal.dump(list.to_a)) file_path = File.expand_path...

...links to work on Gnome/Linux. Here is how it finally worked for me: Step 1: Add a Desktop launcher Add this file to ~/.local/share/applications/rubymine.desktop: [Desktop Entry] Version=1.0 Type=Application...

...to affect the whole container text, not separate children. For example, .container %p Text 1 %p Text 2 %p Text 3 with .container display: -webkit-box would be shown as...

...row.insertBefore imageTemplate # Prepare the template to be cloned for the next image increaseTemplateIndices: -> # E.g. ("[1]", "1") -> "[2]" increase = (match, $1) -> match.replace $1, parseInt($1) + 1 imageTemplate.find('input').each -> $input = $(this...

# @return: The progress bar element addProgressBar: (element) -> progressBar = $(' ').addClass('image--progress').css 'width', '100%' progressBar.appendTo element.find('.image') # This progress bar *shrinks* from full width to the right updateProgressBar: (event...

...instance use only 20GB disk space but the disk file on the server has 100GB (or even more). To resize the disk file do the following: Check storage on the...

vm $ df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 99G 19G 75G 21% / udev 2.0G 12K 2.0G 1% /dev tmpfs 396M 236K 396M 1% /run...

exim -Mvc $messageid # print all frozen messages exiqgrep -z -i | xargs -n 1 exim -Mvc | less Delete frozen mails in the queue Maybe you should check which messages...