Wildcard VirtualHost with Apache2
Set your ServerAlias directive to *.domain.tld - Here is a quick example.
<VirtualHost>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /var/www/path/to/site
</VirtualHost>
Now everything.example.com and anything.example.co...
Written by Sean Behan on 06/17/2012
Ruby strftime() method arguments
Just for reference strftime() arguments in ruby.
Usage `Time.now.strftime("%B/%d/%Y")`
%a weekday name.
%A weekday name (full).
%b month name.
%B month name (full).
%c date and time (locale)
%d day of month [01,31].
%H hour [00,...
Written by Sean Behan on 03/05/2017
Namespacing in Rails
With namespace routes in Rails you can easily create a prefix for select resources. For instance, if you have an admin area or an account dashboard you can give logged in users access to methods that are not otherwise available. To use namespaces define t...
Written by Sean Behan on 06/17/2012
Using Prototype to Access Form Data
Prototype has a powerful API for accessing and manipulating the Document Object Model, A.K.A the DOM. The following code will let you interact with a simple web form.
Suppose we have a form that contains hidden/or locked inputs and they need to be update...
Written by Sean Behan on 06/17/2012
Parse for Links with Prototype JS
Parsing for links with the Prototype javascript library is easy. Here is the pattern for finding links
/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^
=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/
And to implement it you can loop through your con...
Written by Sean Behan on 06/17/2012
Add Users to a Group on Ubuntu
To create a new user on Ubuntu (Heron8)
adduser johndoe
To create a new group
groupadd barleyfarmers
Add johndoe to the barleyfarmers group
adduser johndoe barleyfarmers
The adduser command, when you're first adding the new user accou...
Written by Sean Behan on 03/02/2017
using screen
Use screen when you want to manage multiple sessions in a terminal. Install it on Ubuntu
sudo apt-get install screen
There are a lot of options for screen. I won't go into them. I use screen most often when I shell into a remote server and want to hop i...
Written by Sean Behan on 06/17/2012
paypal ipn simulator
If you use the Paypal sandbox you'll notice that there is an IPN Simulator test tool. You must be logged to use it. This tool lets you test an IPN handler script for your application. If your script is not correct and you try to send a test IPN transactio...
Written by Sean Behan on 06/17/2012
git checkout -- file-in-question.oh-my
Problem: using git and one file, like your db/schema.rb, is out of whack with the latest branch. If you run git pull and you get a failed merge and no update. You can of course, edit the conflicts manually. But what if you're confident that the latest sch...
Written by Sean Behan on 06/17/2012
rails fixtures: using the right timestamp
Fixtures in Rails allow you to quickly and easily populate a database with sample data. They are great when testing your app and you need to test against a condition that will rely on a certain preexisting data point.
Fixtures are located in your RAILS_R...
Written by Sean Behan on 06/17/2012