Highlight String in PHP
Function for highlighting text/strings in PHP.
$content = file_get_contents("http://php.net/");
print highlight("PHP", $content);
function highlight($match, $string){
return str_ireplace($match, "<span style='background:yellow'>$match</span&...
Written by Sean Behan on 06/17/2012
Vim Tips and Tricks
The following tips and tricks can be put into your .vimrc file
Remap jj to esc
imap jj <Esc>
Quickly leave edit mode and back to visual mode with jj. This is probably the fastest key combination possible and one of the most frequent key combinatio...
Written by Sean Behan on 06/17/2012
The survey for people who make websites
I took the survey!
Click here to take it →
Written by Sean Behan on 06/17/2012
How To Write Your Own Time Comparison Function in Ruby Like time_ago_in_words Without Rails
# time_ago_in_words(Time.now, 1.day.ago) # => 1 day
# time_ago_in_words(Time.now, 1.hour.ago) # => 1 hour
def time_ago_in_words(t1, t2)
s = t1.to_i - t2.to_i # distance between t1 and t2 in seconds
resolution = if s > 29030400 # seco...
Written by Sean Behan on 10/17/2013
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