Skip to content

Instantly share code, notes, and snippets.

View paulredmond's full-sized avatar
🏴‍☠️

Paul Redmond paulredmond

🏴‍☠️
View GitHub Profile
#!/usr/bin/env ruby
require 'rubygems'
require 'Sprockets'
require 'Jsmin'
MINFILE = 'app/webroot/js/build-min.js'
CONCATFILE = 'app/webroot/js/concat.js'
secretary = Sprockets::Secretary.new(
:asset_root => 'app/webroot',
<?php
/**
* PluginRoute class.
*
* Route class for plugins that allows you to clean up urls for plugins
* without tons of calls to Router::connect() to shorten controller names in urls.
*/
class PluginRoute extends CakeRoute
{
# --------------------------------------------
# General
# --------------------------------------------
set :shared_children, %w(cache logs) # Shared directories, these directories contain generated content which should not be wiped out during deployments.
set :application, "domain.com" # Application name
set :deploy_to, "/var/www/#{application}/#{stage}" # Path where files are deployed to ...
# --------------------------------------------
# Server
# --------------------------------------------
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 '5adf1a537895c2ec933fddd48e78d8a2'
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 '5adf1a537895c2ec933fddd48e78d8a2'
# Run from the terminal to generate phpdocumentor files
phpdoc -d ~/path/to/app -t ~/path/to/place/docs -ti 'Documentation Title' -dn 'defaultpackage'
@paulredmond
paulredmond / timeago.php
Created December 15, 2010 22:27
Function that returns time ago results from a strtotime-friendly string such as a datetime
<?php
function timeago( $params )
{
$conversions = array(
'millisecond' => 1,
'second' => 1000,
'minute' => 60,
'hour' => 60,
'day' => 24,
<!-- broken -->
<a href="#" class="connect-login">
<img src="http://media.sheknows.com/dares/ui/connect_sign_in.png" alt="Sheknows Connect">
</a>
<!-- :) -->
<a href="#" class="connect-login" data-redirect="/dares">
<img src="http://media.sheknows.com/dares/ui/connect_sign_in.png" alt="Sheknows Connect">
</a>
<?php
$dir = new RecursiveDirectoryIterator(dirname(__FILE__));
$iterator = new RecursiveIteratorIterator($dir);
$pattern = '~\{(.+?)\}~im';
$start_char = '{';
$end_char = '}';
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame