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...

...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...

...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...

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

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

...is out of range (Redis::CommandError) This is because Redis defaults to at most 16 databases (0 to 15) and running tests in parallel might exceed that (your tests might...

...run on databases 1..n or 2..(n+1)). You can increase that limit: Get number of CPUs of your machine. nproc --all Open up Redis configuration file.

developer.mozilla.org

...but must also render nicely for browsers that don't support it (mostly Safari <17.5). Step 1: Put some s into your HTML First, place explicit line breaks that should...

...suppress_multiple_term_dialog = True [keybindings] [profiles] [[default]] cursor_color = "#aaaaaa" font = Ubuntu Mono 14 use_system_font = False [layouts] [[PROJECT_NAME]] [[[child0]]] type = Window parent = "" position = 3458:171 maximised...

...profile = default command = 'env startup_cmd="foreman start" startup_args="-f Procfile.dev -m all=1,web=0" bash' [plugins] To make the environment variables work, put the following into your...

makandra dev

...into pairs of two, you can use the Rails ActiveSupport method in_groups_of: >> [1, 2, 3, 4].in_groups_of(2) => [[1, 2], [3, 4]]

...in_groups_of(2) => [[1, 2], [3, 4], [5, nil]] >> [1, 2, 3, 4, 5].in_groups_of(2, 'abc') => [[1, 2], [3, 4], [5, 'abc']]

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...

edgeapi.rubyonrails.org

How generated form params look like If you have authors with the IDs 1, 2 and 3, the check boxes above will be named like this: Note the hidden...

In your Rails controller, this will create params like this: { 'post' => { 'author_ids' => ['1', '2', '3', ''] } } Permitting array params in your controller Note that you need some special syntax...

...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...

...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...

...t be able to call gsub with a block and match reference variables like $1. They will be nil inside the block where you define replacements (as you already know...

...Here is a fix to SafeBuffer#gsub. Note that it will only fix the $1 behavior, not give you a safe string in the end (see below). Example

...f mysql5.1 -d "default parameter with utf8" --aws-credential-file ./aws-credential.txt --region eu-west-1 The output should look like this: DBPARAMETERGROUP utf8 mysql5.1 default with utf8 Now change the...

...parameter of the new parameter group /home/foobar/Downloads/RDSCli-1.4.007/bin/rds-modify-db-parameter-group utf8 --region eu-west-1 --aws-credential-file .aws-credential.txt \ --parameters="name=character_set_server, value=utf8, method=immediate" \ --parameters="name=character_set_filesystem...

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

Specify these gem versions in your Gemfile: gem 'cucumber', '~> 1.3.0' gem 'cucumber-rails', '= 0.3.2' # max version for Rails 2 gem 'capybara', '< 2' # capybara 2+ requires Rails 3 gem 'mime-types...

...dependeny of capybara gem 'nokogiri', '< 1.6' # dependency of capybara gem 'rubyzip', '< 1' # dependency of selenium-webdriver, rubyzip 1+ requires Ruby 1.9 gem 'cucumber_factory' gem 'database_cleaner', '< 1'

when 'the homepage' root_path when /^the list of (.*?)$/ models_prose = $1 route = "#{model_prose_to_route_segment(models_prose)}_path" send(route) when /^the (page|form...

...for the (.*?) above$/ action_prose, model_prose = $1, $2 route = "#{action_prose == 'form' ? 'edit_' : ''}#{model_prose_to_route_segment(model_prose)}_path" model = model_prose_to_class(model_prose)

...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...

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...

...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...

Connect to your memcached host. (AWS elasticache is memcached) telnet foohost23.cs2631.0001.euw1.cache.amazonaws.com 11211 Once you're connected, find out which 'slabs' exist within the cache: stats items STAT items:1:number...

...STAT items:1:age 5166393 STAT items:1:evicted 0 STAT items:1:evicted_nonzero 0 STAT items:1:evicted_time 0 STAT items:1:outofmemory 0