How to Time Piped *nix Commands
If you want to time how long a piped bash command take, use the `time` command followed by your commands in parens like so.. time (ls -lha | wc -l)
Written by Sean Behan on 12/11/2017
How to Calculate Age with PHP
Calculate age in PHP $your_birthday = '1982-08-29'; $difference = date_diff(date_create(), date_create($your_birthday)); $age = $difference->format('%Y'); // 35 Short and sweet
Written by Sean Behan on 11/11/2017
How to Create A Unix Timestamp or the Epoch in Python
It's a little convoluted. Seeing as it's a pretty common thing you use when programming computers one might think that there would be a quick and easy method for it. But from what I can tell there isn't. So here is a snippet that will give you a *nix Epoc...
Written by Sean Behan on 11/02/2013
How to Create a Date Time Snippet in Sublime Text 2 (Dynamic Signature with Time Stamp)
You'll have to create a new plugin. From the menu bar select Tools > New Plugin Copy the Python script from the signature.py file. Remember to replace your email address (it's example.com). Save the file, signature.py, is fine. Next open up Prefer...
Written by Sean Behan on 06/17/2012
Rails Find All by Birthday: How to Find Upcoming Birthdays with ActiveRecord
There are a few ways to solve this problem. However, I think the easiest is to cache the day of the year that the user is born on as an integer. If stored alongside the timestamp we can quickly get a list but properly handle the full birthday elsewhere, s...
Written by Sean Behan on 06/17/2012
Rails Helper to Remove Leading Zero in 12 Hour Time Format
I can't find a strftime() format that will output the hour without the leading zero. For instance 6:20 will be instead 06:20. This just looks a little sloppy. I created a datetime.rb intializer which will contain custom datetime formats for my applicatio...
Written by Sean Behan on 06/17/2012
Ruby Strftime Day Without the Leading Zero
%e # rather than %d Time.now.strftime("%e")
Written by Sean Behan on 06/17/2012
Generate MySQL Datetime Type Using PHP Date() Function
If you want to insert a datetime that matches the default mysql datetime type format use this date('Y-m-d H:i:s');
Written by Sean Behan on 06/17/2012
Managing Timestamps in MySQL with a Trigger
MySQL doesn't support having two columns with time stamping on both initialization and/or on updating at the same time. It would be nice to be able to do *this* where the created_at column gets the current_timestamp on initialization and the updated_at ge...
Written by Sean Behan on 06/17/2012
Date and Time Helpers in Rails
Just for reference http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001695 This post was created about ago
Written by Sean Behan on 06/17/2012
Problem slash Bug in Rails with attr_accessor and Datetime Select Fields
Looks like there is a problem with using the attr_accessor method with datetime form fields http://dev.rubyonrails.org/ticket/8983 In Rails 2.3.2, for me at least, the problem seems to be popping up again. While trying to process a date for credit card v...
Written by Sean Behan on 06/17/2012
Custom Date Formats for Your Rails Application
If you use a consistent date format often in your Rails applciation, it is worth it to add the format to your application environment. You can do this by adding  it to the bottom of the config/environment.rb file. Time::DATE_FORMATS[:my_custom_format] ...
Written by Sean Behan on 06/17/2012