A Regular Expression to Generate Dash Separated Slugs AKA Pretty URLs
This regular expression matches non alphanumeric characters in a string.
r = /[^a-z0-9]{1,}/i
You can use it to create URL friendly slugs.
slug = "hello world!".gsub(/[^a-z0-9]{1,}/i, '-').downcase # => hello-world
In combination wit...
Written by Sean Behan on 08/22/2013
How To Pipe To A Ruby Command Line Application
You need to read from STDIN rather than parse command line arguments.
while $stdin.gets
puts $_
end
Written by Sean Behan on 10/17/2013
Install MySQLdb for Python on Mac OS X
I don't do much python development. I really like the language and there are a lot of great software projects out there for it. Tornado, for example, is a fast non-blocking web server in python, just open sourced by Facebook that is the engine behind Frie...
Written by Sean Behan on 06/17/2012
My First Python Package on PyPi - Command Line Blog
I wrote my first Python package over the weekend. It is a simple package that adds a basic blog API to an existing Flask application.
It's called `command_line_blog` and is available [on Github](https://github.com/seanbehan/command_line_blog) and [on ...
Written by Sean Behan on 03/02/2017
How to Create a Slug in Python with the Re Module
There are a few 3rd party modules that do this sort of thing. But there is a pretty solution using out of the box Python functionality. You don't have to install any dependencies if you use the `re` module.
import re
text = ' asdfladf ljklasfj 2324...
Written by Sean Behan on 03/02/2017