XPath with HTML in PHP One Liner
Here is a one liner for using XPATH with HTML in PHP
$doc = new DOMXPath(@DOMDocument::loadHTML(file_get_contents("https://www.reddit.com/r/PHP/")));
Now you can use XPATH to query the html..
foreach($doc->query("//a") as $el){
echo $el->no...
Written by Sean Behan on 11/14/2017
Extending Rails Form Builders
Extending forms in Rails is simple and will greatly reduce the amount of code in your views. This example is taken right from the Agile Web Development book on Rails(2.1.*) with one minor tweak. I want to pass a label argument along with the field name so...
Written by Sean Behan on 06/17/2012
Using Your Partials in Your Liquid Templates
I'm working on a project that requires users/designers be allowed to edit the layout of their site. I'm using Liquid, Ruby templating system developed by the folks at shopify.com.
Doing a little searching I found this great post http://giantrobots.though...
Written by Sean Behan on 06/17/2012
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
using rails paperclip plugin on ubuntu
paperclip is an awesome plugin for rails. it let's you attach an image to any of your models. installation and usage more information is available at http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/
by default paperclip uses the image m...
Written by Sean Behan on 06/17/2012