Prev PageNext Page
Listing Files and Directories with PHP
Listing all files and directories using PHP 5. <?php $files = array(); $dir = dir("."); while(false!==($file=$dir->read())): if(($file{0}!=".") && ($file{0}!="~") && (substr($file, -3)!="LCK") && ($file!=basename($_SERVER["PHP_SELF"]))): ...
Written by Sean Behan on 06/17/2012
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
Absolutize Relative Links Using PHP and Preg_Replace_Callback
I was in the market for a simple php script to replace hrefs with their absolute paths from scraped web pages. I wrote one myself. I used the preg_replace_callback function so that I could pass the parsed results as a single variable. <?php $domain =...
Written by Sean Behan on 06/17/2012
Hello Rack
What is Rack? Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and sof...
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
Placing an Authenticity Token in a Rails Form
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
Written by Sean Behan on 06/17/2012
Managing Timestamps in MySQL with a Trigger
MySQL doesn't support having two columns with time stamping on both initialization and/or on updating at the same time. It would be nice to be able to do *this* where the created_at column gets the current_timestamp on initialization and the updated_at ge...
Written by Sean Behan on 06/17/2012
Grab a Twitter Status without the Twitter API
Quick and dirty way to grab the users status messages without having to go through the twitter api (not having to authenticate that is). You can grab the RSS feed and indicate the number of statuses returned with the count param. I wrote this function for...
Written by Sean Behan on 06/17/2012
Updating Your Twitter Status with cURL and a Bash Function
I'm usually at the command line so I wrote a little a bash function so that i can type tweet this is really neat but kind of pointless and it will update my twitter status! some characters trip it up but in general it's useful for most of my tweets. The...
Written by Sean Behan on 06/17/2012
Mod_Python and Web.py on Ubuntu
Download First install mod_python for Apache and then restart/reload the server. apt-get install libapache2-mod-python /etc/init.d/apache2 force-reload apache2ctl restart Next grab the web.py framework from webpy.org. You can grab the tar or use easy_in...
Written by Sean Behan on 06/17/2012
Prev PageNext Page