Using Selenium to Drive Firefox Browser for Web Automation
There are a lot of practical uses for automating user behavior in a browser. Everything from testing your web application to logging into Twitter and auto following people.
But first you have to install the tools. Here is everything you need to run yo...
Written by Sean Behan on 03/09/2017
How to Extract Time Information from a Natural Language String with a Regular Expression and PHP
You can easily extract time information from a string with a regular expression and PHP (or any language with regular expressions).
$str = "Here is how to extract time info.. like 4:30 PM and 2:10 AM from a string in PHP";
$rgx = "/\d{1,2}(:?\d...
Written by Sean Behan on 02/26/2018
Ruby Strftime Day Without the Leading Zero
%e # rather than %d
Time.now.strftime("%e")
Written by Sean Behan on 06/17/2012
JSON::GeneratorError: only generation of JSON objects or arrays allowed
If you run into this error message try switching to an earlier version of ExecJs.
JSON::GeneratorError: only generation of JSON objects or arrays allowed
# Gemfile
gem 'execjs', '~> 1.4'
gem 'coffee-script'
gem 'sass'
...
Written by Sean Behan on 08/22/2013
Email Obfuscation and Extraction from Text with Rails
There is a helper method for handling the obfuscation of email addresses in Rails.
mail_to "me@domain.com", "My email", :encode => "hex"
# => My email
If you want to then extract an email address(or all email addresses) from a block of text here is the...
Written by Sean Behan on 06/17/2012