Skip to content

Instantly share code, notes, and snippets.

View sprocketize.rb
#!/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',
View plugin_route.php
<?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
{
View PHP Capistrano Recipe.rb
# --------------------------------------------
# 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
# --------------------------------------------
View php.rb
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'
View PHP 5.3.3 Brew Recipe
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'
View phpdoc.sh
# 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 Dec 15, 2010
Function that returns time ago results from a strtotime-friendly string such as a datetime
View timeago.php
<?php
function timeago( $params )
{
$conversions = array(
'millisecond' => 1,
'second' => 1000,
'minute' => 60,
'hour' => 60,
'day' => 24,
View connect_login.html
<!-- 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>
View fix-smarty.php
<?php
$dir = new RecursiveDirectoryIterator(dirname(__FILE__));
$iterator = new RecursiveIteratorIterator($dir);
$pattern = '~\{(.+?)\}~im';
$start_char = '{';
$end_char = '}';
View gist:955688
<!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