Skip to content

Instantly share code, notes, and snippets.

View byronrode's full-sized avatar

Byron Rode byronrode

View GitHub Profile
@byronrode
byronrode / update_timthumb.sh
Created September 20, 2011 12:31
Update TimThumb across your Server
#!/bin/bash
# Fix TimThumb
# The following will replace any versions of timthumb.php or thumb.php across your server.
# Change the folder to match your server's setup.
# If you have made any modifications, or have any additional allowed hosts in your current
# TimThumb file they will be updated, so make sure you have those changes backed up.
wget -q -O /tmp/new_timthumb.php http://timthumb.googlecode.com/svn/trunk/timthumb.php
find /var/www/vhosts/ -name "thumb.php" -exec bash -c "echo Replacing file {} && cp /tmp/new_timthumb.php {}" \;
@byronrode
byronrode / twitter.platform.js.markdown
Created May 17, 2011 08:10
Twitter Intents over SSL

Serving Twitter's JS for Intents or Tweet Button's is a pain when it comes to SSL as Twitter has no SSL Cert installed on their serving subdomain. To get around this, without having to manually maintain the JS, I came up with the following workaround.

Create a file called twitter.platform.js.php in your JS Folder and paste the following:

<?php
header('Content-type: text/javascript'); 
echo file_get_contents('http://platform.twitter.com/widgets.js');
?>
@byronrode
byronrode / morph-demo-countdown-timer.php
Created March 30, 2011 11:16
This function generates and returns static time remaining for Morph Demo refresh, based on current server time. To customize the output, edit the $time_remaining string.
<?php
function get_time_remaining($duration_in_hours){
$timestamp = time();
$current_minutes = date('i', $timestamp);
$current_seconds = date('s', $timestamp);
// pluralize hours, minutes and seconds
(($duration_in_hours - 1) == 1) ? $hours = ' hour ' : $hours = ' hours ';
((60 - $current_minutes) <= 01) ? $minutes = ' minute ' : $minutes = ' minutes ';