Skip to content

Instantly share code, notes, and snippets.

@joshuamilford
joshuamilford / gruntfile.js
Last active September 1, 2016 17:32
My Gruntfile
module.exports = function(grunt) {
grunt.initConfig({
notify: {
watch: {
options: {
title: 'Grunt Watch',
message: 'Good to go!'
}
}
},
@joshuamilford
joshuamilford / test
Created May 8, 2013 14:52
This is a test gist
lorem ipsum
@joshuamilford
joshuamilford / test
Created May 8, 2013 14:53
This is a test gist
lorem ipsum
@joshuamilford
joshuamilford / gist:5483804
Created April 29, 2013 18:53
round difference between 2 times to nearest quarter hour.
((round(((strtotime($end) - strtotime($start)) / 60) / 15) * 15) / 60)
@joshuamilford
joshuamilford / gist:5483806
Created April 29, 2013 18:54
round difference between 2 times to nearest quarter hour.
((round(((strtotime($end) - strtotime($start)) / 60) / 15) * 15) / 60)
@joshuamilford
joshuamilford / gist:3305603
Created August 9, 2012 16:22
Fluid Grid Maker
<?php
$width = 960;
$columns = 12;
$margin = 10;
$column = ($width / $columns) - (2 * $margin);
echo '<pre>';
$spans = '';
for($i = 1; $i <= 12; $i++)
{
$spans .= '.span_' . $i . ', ';
@joshuamilford
joshuamilford / gist:2263987
Created March 31, 2012 13:06
display errors
error_reporting(E_ALL);
ini_set("display_errors", 1);
@joshuamilford
joshuamilford / gist:2050344
Created March 16, 2012 14:40
php typography-izer
//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)
@joshuamilford
joshuamilford / gist:1223002
Created September 16, 2011 20:06
mysql ucfirst
CONCAT(UPPER(SUBSTR(field,1,1)), SUBSTR(field, 2))
function getNamed($string){
$bad = array(
'&#128;' => '&#8364;',
'&#130;' => '&#8218;',
'&#131;' => '&#402;',
'&#132;' => '&#8222;',
'&#133;' => '&#8230;',
'&#134;' => '&#8224;',
'&#135;' => '&#8225;',
'&#136;' => '&#710;',