Hi

I'm Sean.

I write about #software, #SaaS, #consulting and #mobile app development

I code in #Python, #PHP, #Swift, #Ruby, #ReactJS and #Postgres


Random Blog Posts See more posts

Select Basename in Postgres SQL
Postgres doesn't have a basename function per se. But it's easy to accomplish. select regexp_replace('http://www.seanbehan.com/images/logo.png', '.+/', '') ; -- Will return logo.png
Written by Sean Behan on 08/16/2018
Roll Your Own Full Page Caching in Sinatra
It's as simple as this. # app.rb get '/:slug' do @slug = File.basename("#{params[:slug]}") @cache = "public/cache/#{@slug}.html" if File.exists?(@cache) File.read(@cache) else @post = Post.find_by(page: params[:slug]) ...
Written by Sean Behan on 08/23/2013
Trouble Using Attr_Accessor in Rails Models and Forms
You might use the attr_accessible method to create getters and setters for a class that has attributes which don't map directly to corresponding fields in a database. For example let's take the scenario where you are processing a credit card transaction. ...
Written by Sean Behan on 06/17/2012
PHP Paypal IPN Script
Simple script for posting a valid response back to Paypal service after a sale is completed using the Paypal Instant Checkout payment method. <?php // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $k...
Written by Sean Behan on 06/17/2012
Disk Usage Information on Mac OS X
Get disk usage information about the Desktop $ du -h -d 0 Desktop 14G Desktop Information about how much free space is available on computer $ df -lh Filesystem Size Used Avail Capacity Mounted on /dev/disk0s2 111Gi 109Gi 2.3Gi 98% / ...
Written by Sean Behan on 06/17/2012