How To Add A Route With A Forward Slash in Params with Rails 3 Application
Use an asterisk in the pattern to match for everything after it. In the example below, date will be available in the params hash as params[:date].
SPB::Application.routes.draw do
# http://example.com/calendar/2007/10
# params[:date] => "2007/1...
Written by Sean Behan on 06/22/2012
How To Get A Dict from Flask Request Form
The `request.form` object is an immutable dictionary. An `ImmutableMultiDict` object to be exact. Immutable means that you cannot change its values. It's frozen.
However, you might want to change the values. Say for instance, creating a slug from a ti...
Written by Sean Behan on 03/02/2017
Parsing URL Parameters with Swift
Here is an extension you can use in your Swift (v4) projects that makes it easy to parse parameters from a url.
Given a url like, "http://example.com/?x=1&y=2", you can extract the x and y parameters into a key, value data structure.
Here is the s...
Written by Sean Behan on 09/23/2018
Reading, Writing, Removing Files and Directories in Ruby
These aren't all of them, but I think they are some of the most useful.
# making a directory in another directory that doesn't yet exist...
FileUtils.mkdir_p '/path/to/your/directory/that/doesnt/exist/yet'
# recursively remove a directory and the conten...
Written by Sean Behan on 06/17/2012
How to Extract Time Information from a Natural Language String with a Regular Expression and PHP
You can easily extract time information from a string with a regular expression and PHP (or any language with regular expressions).
$str = "Here is how to extract time info.. like 4:30 PM and 2:10 AM from a string in PHP";
$rgx = "/\d{1,2}(:?\d...
Written by Sean Behan on 02/26/2018