Skip to content

Instantly share code, notes, and snippets.

View gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
notify: {
watch: {
options: {
title: 'Grunt Watch',
message: 'Good to go!'
}
}
},
@joshuamilford
joshuamilford / test
Created May 8, 2013
This is a test gist
View test
lorem ipsum
@joshuamilford
joshuamilford / test
Created May 8, 2013
This is a test gist
View test
lorem ipsum
@joshuamilford
joshuamilford / gist:5483806
Created Apr 29, 2013
round difference between 2 times to nearest quarter hour.
View gist:5483806
((round(((strtotime($end) - strtotime($start)) / 60) / 15) * 15) / 60)
@joshuamilford
joshuamilford / gist:5483804
Created Apr 29, 2013
round difference between 2 times to nearest quarter hour.
View gist:5483804
((round(((strtotime($end) - strtotime($start)) / 60) / 15) * 15) / 60)
View gist:3305603
<?php
$width = 960;
$columns = 12;
$margin = 10;
$column = ($width / $columns) - (2 * $margin);
echo '<pre>';
$spans = '';
for($i = 1; $i <= 12; $i++)
{
$spans .= '.span_' . $i . ', ';
View gist:2263987
error_reporting(E_ALL);
ini_set("display_errors", 1);
@joshuamilford
joshuamilford / gist:2050344
Created Mar 16, 2012
php typography-izer
View gist:2050344
//escape everything in tags
preg_match_all('/(\<[^\>]+\>)/', $string, $tags);
foreach($tags[0] as $key=>$value)
{
$string = str_replace($value, str_replace(array('"', "'"), array('\"', "\'"), $value), $string);
}
//replace double quotes
preg_match_all('/(?<!\\\)"([^"]+)"/', $string, $matches);
foreach($matches[0] as $key=>$value)
View gist:1223002
CONCAT(UPPER(SUBSTR(field,1,1)), SUBSTR(field, 2))
View gist:1212044
function getNamed($string){
$bad = array(
'&#128;' => '&#8364;',
'&#130;' => '&#8218;',
'&#131;' => '&#402;',
'&#132;' => '&#8222;',
'&#133;' => '&#8230;',
'&#134;' => '&#8224;',
'&#135;' => '&#8225;',
'&#136;' => '&#710;',