CSS is a lot easier to write and read than clumsy XPath expressions. So when you need to use XPath, you can have Nokogiri help you out on creating it...

Not all email clients support external images in all situations, e.g. an image within a link. In some cases, a...

Building application assets with esbuild is the new way to do it, and it's great, especially in combination with...

In case Ruby does not detected the expected encoding of a file automatically you can specify the known encoding manually...

makandra dev

Here is a full-fledged example: describe Lock, '.acquire' do before :each do @reader, @writer = IO.pipe end def fork_with_new_connection config = ActiveRecord::Base.remove_connection fork do

...the same lock' do (1..20).each do |i| fork_with_new_connection do @reader.close ActiveRecord::Base.connection.reconnect! Lock.acquire('lock') do @writer.puts "Started: #{i}" sleep 0.01 @writer.puts "Finished: #{i}" end @writer.close...

Old structure: /attachments/123456789/ /file.pdf New structure: /attachments/123/456/789/ /file.pdf Be sure to also read our card on migrating from Paperclip to Carrierwave, especially the list of possible errors that...

...collection to be a somewhat grouped collection (array of arrays, hash, ...) that it can read from. In "the real world" you usually already have your list of items to select...

...this only works if you are grouping by something that should be the human-readable optgroup label which is almost always the case...

makandra dev

...result in data loss! Stop your database via the MySQL shell: FLUSH TABLES WITH READ LOCK; Do not close the shell as this would remove the read lock we just...

...in a new terminal): mysqldump -uroot -p -r the_dump.sql some_project_production Remove the read lock (from the MySQL shell): UNLOCK TABLES; The master server will now resume operations. New...

makandra dev
iamvdo.me

...value 1, but the default is normal. OK, but what normal is? We often read that it is (or should be) 1, or maybe 1.2, even the CSS spec is...

...result into ps2eps. cat input.svg | cairosvg -f ps - | ps2eps -q > output.eps ps2eps by default reads from stdin and writes to stdout. You can either capture that output in your own...

...in parallel tests manually, you normally need to handle these issues: When multiple processes read and write to a directory with the same name e.g. tmp/some-test-folder you might end up...

...like "#{Rails.env}#{ENV['TEST_ENV_NUMBER']}" in you directory path when using Dir.mkdir. Further reading: If a single temporary file is enough for you, use Tempfile.new

makandra dev

...feature without the -i flag, but until now it seems not to be possible. Read more about our recommended git workflow for feature branches. Also have a look at git...

makandra dev

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

...are some implementation details you might want to reuse: Use the existing models to read the files from Use your own carrierwave models to write the files to the new...

makandra dev
content-security-policy.com

...Does not affect CSS or Images img-src and style-src directives still apply. Read further A good default CSP can be found at Strict CSP...

...it replaces the legacy switches --no-rdoc --no-ri. Its abbreviated version is -N.) Read the RubyGems command reference for more information...

config.active_record.schema_format = :sql This will make a db/development_structure.sql appear which is then also read and loaded when you do a db:test:prepare. rake db:test:clone

...the schema.rb for you) -- but you may run into problems. The task's description reads: rake db:test:clone # Recreate the test database from the current environment's database schema...

...Luckily, we can use PostgreSQL's window functions to speed things up. You can read more about window functions here, but for our purposes, know that the following SQL does...

...delegators and def_delegator is a complete mess that makes your code hard to read. Consider these classes: class Topic < ActiveRecord::Base def title "A title" end def category

def_delegators :topic, :title, :category end Here, we can say Post.new.title and actually read title from the Post's Topic object. Because of what we defined for Post, this...

...gives some additional security to the not-that-incredibly-secure hashed paths storage approach. Read here for details. Further reading Common mistakes when storing file uploads with Rails

This is not very flexible, and failure messages will be hard to read. Instead, consider doing this: SomeApi.should_receive(:find) do |params| params[:query].should == '*foo*' params[:sort...

makandra dev

States (buttons, form elements) Interpretation of content is simplified for parsers (screen readers, search engine spiders) Sectioning HTML documents HTML5 brought a batch of new section elements, the...

...may be used to provide the expanded version. data: some data, where the machine-readable form is given in the value attribute. E.g. for dates time: some datetime expression (see...

...users not only to access those files but also any files your application can read, like this: invoices/generated?number=../../../../../etc/passwd # => send_file '/etc/passwd' You do not want this. In most...

...at its maximum width without any indentation. This will make code blocks difficult to read. See also: CSS: Flex and "min-width...