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

...place where the application usually gets its keys from. The keytool is able to read certificate files but does not understand private key files which you need to use your...

...application created by AgentBob and also attached to this note. You do want to read through such code first and not mindlessly use it on your private keys.

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

miekd.com

...the article using a different formatting style so that it jumps out at the reader. Blatantly copying the excerpt of the pull quote into it’s own element is not...

...a structural representation of the excerpt would be seen twice by people using feed readers or services like Instapaper, as well as be re-read for people who use screen...

If you need to capture signatures on an IPad or similar device, you can use Thomas J Bradley's excellent...

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

...cap production app:logs 00:00 app:logs 01 tail -n0 -F /var/www/your-application/shared/log/production.log | while read line; do echo "$(hostname): $line"; done 01 app01-prod: Started GET "/sign_in" for 1.2.3.4 at...

...LOG'] || fetch(:rails_env) execute %(tail -n0 -F #{shared_path}/log/#{logfile}.log | while read line; do echo "$(hostname): $line"; done) end end end If you have some other log...

makandra dev
mupdf.com

MuPDF is a PDF reader that renders very quickly, yet still correctly. It supports PDF 1.7 and all the fancy shenanigans that evince (Ubuntu's default PDF reader) fails to...

...your latest-version PDF documents properly, you probably still have to resort to Adobe Reader or the lp command...

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

...a TimeWithZone). You need to use Time.current, Date.current, DateTime.current, Time.zone.parse, etc. everywhere. You should read this guide for a pretty exhaustive list of all the things you need to pay...

...Rails 3, open config/environment.rb and define your time zone: config.time_zone = 'Berlin' Again, please read the working with time zones in Ruby on Rails from Elabs before you do anything...

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

makandra dev
github.com

"rock it Español style".to_url => "rock-it-espanol-style" "tell your readers 你好".to_url => "tell-your-readers-ni-hao" The above conversions of special chars, like...

...using this regularly, as it has high potential to make your tests hard to read and understand. You're often better of by using factories, generally different implementation patterns, or...

...Encoding.default_external, notably the string inside a StringIO.new some strings created via CSV files read from disk strings read from an IRB Encoding.default_external defaults to whatever locale charmap says...

makandra dev
tldp.org

...Applied to files > creates or overwrites a file >> creates or appends to a file < reads from a file, where < is taken as 0< Note: You should be pretty sure of...

...grep da * 1>&2 everything: do_stuff &> /dev/null combined: command < input-file > output-file, reads from input-file and writes stdout to output-file

To read the Rails session from a Rack middleware, use env['rack.session']. It's an ActionDispatch::Request::Session object. class MyMiddlware def initialize(app) @app = app end def call(env...

The code below shows a method #validate which uses Nokogiri to validate an XML document against an XSD schema. It...

makandra dev
alan.norbauer.com

Call and Debug a Function Pause Execution on URL Change Debugging Property Reads Use copy() Debugging HTML/CSS

...seems not as obvious as if you are using JSON. To safely write and read YAML files you should use Psych#dump (String#to_yaml) and Psych.safe_load (YAML.safe_load...

paweldabrowski.com

...use a form object here" You can learn about new code patterns You should read the sections "Advantages of using design patterns" and "Disadvantages of using design patterns in a...

You can use heredoc to avoid endlessly long lines of code that nobody can read. Heredoc strings preserve linebreaks and can be used like this: def long_message