How to Extract all Images from a Webpage with Ruby
Here is a little ruby snippet that will download all pictures from a webpage. Rather than using XPath, we are going to first reduce the source code to capture everything inside of quotes. Some websites use JSON w/in a script tag to lazy load images an...
Written by Sean Behan on 08/01/2018
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
I Just Published My First PHP Package HTMLXPATH
I just wrote and published my first PHP package on Packagist.com. It's available on [packagist.org](https://packagist.org/packages/htmlxpath/htmlxpath) and the source code is on [github](https://github.com/seanbehan/htmlxpath). To install the package u...
Written by Sean Behan on 03/28/2017
Rails 3 Config Auto Load Paths in Application.rb
In Rails 3 files in lib/ are no longer loaded by default. It's a snap to auto load these classes by adding the following line to config/application.rb config.autoload_paths += %W(#{config.root}/lib) This is commented out around line 16. Either rep...
Written by Sean Behan on 06/17/2012
Install and Serve a Rails Application from PHP Subdirectory Using Apache, Phussion Passenger and Ruby Enterprise Edition
Here is how to install a Rails application out of a subdirectory (rather than as a subdomain) with the Apache web server(Apache2). In this example I'm going to use my own blog which is a Wordpress installation and serve a Rails application from the subdir...
Written by Sean Behan on 06/17/2012
How to Get Your User's SHELL and PATH Information
How to find your user SHELL and PATH on Linux echo $PATH echo $SHELL Which will print the paths to the screen /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games /bin/bash
Written by Sean Behan on 06/17/2012