How to Find the Directory Locations Your XCode App Uses
You can add this snippet to your application, say for instance in your `viewDidLoad` function, that will print to the XCode console, the location of your app while it's being developed.
// prints the location of asset my-added-file.txt that you've ad...
Written by Sean Behan on 06/06/2018
Non Standard Port Number with SSH and Git
Here is an example using the port 4567 to connect with over ssh and git
ssh remote add origin ssh://sean@seanbehan.com:4567/path/to/git
git push origin master
Written by Sean Behan on 06/17/2012
Protect a Directory with Apache, .htaccess and httpasswd
Apache comes with a command line utility called "htpasswd". This utility will generate a username and password that you can use to authenticate against using a .htaccess file. Just run the utility like so:
htpasswd -c /path/to/your/password/directory/a...
Written by Sean Behan on 06/17/2012
How to Render Partials with an Underscore in Sinatra
Sinatra doesn't have a method for rendering partials. It defers to the template language of your choice. For instance, if you're using ERB, it's as simple as
erb :'path/to/partial'
Rails has a nice convention of using an underscore to mark file...
Written by Sean Behan on 10/13/2013
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