Skip to content

Instantly share code, notes, and snippets.

View Stanton's full-sized avatar
💃

Paul Stanton Stanton

💃
View GitHub Profile
@Stanton
Stanton / html.html
Created May 29, 2012 10:48
dark on light inset text
text-shadow: 0px 1px 0px #e5e5ee;
@Stanton
Stanton / white-space.css
Created April 23, 2012 08:30
CSS white-space - Cross browser
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE 5.5+ */
<?php
$test = array('a', 'b', 'c');
function clean($input)
{
$output = $input . '!';
return $output;
}
@Stanton
Stanton / ie_inline-block.css
Created March 14, 2012 09:56
Inline block for IE6 & IE8
.element {
display: inline-block;
}
* + .element { // IE 6-7
display: inline;
}
@Stanton
Stanton / target.js
Created March 12, 2012 13:00
Cross browser JavaScript event.target
/**
* A cross-browser method to get the correct event target
* @param object e The event being fired
* @return object targ The event target
*/
Navigation.prototype.getEventTarget = function(e)
{
var targ;
if (e.target) { // W3C
@Stanton
Stanton / gist:1606415
Created January 13, 2012 14:15
Add method
<?php
App::uses('AppController', 'Controller');
/**
* Users Controller
*
* @property User $User
*/
class UsersController extends AppController {
@Stanton
Stanton / gist:1476863
Created December 14, 2011 14:46
Validation for James
<?php
// set up a stack
$options = array();
/* our list of values to ignore (the ones that are permitted to be duplicates)
(made into an array so that you can easily add other options to be ignored,
without having to modify the other rules) */
$exceptions = array('10');
@Stanton
Stanton / gist:1390945
Created November 24, 2011 09:19
Release notes schema
# Dump of table release_notes
# ------------------------------------------------------------
CREATE TABLE `release_notes` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`version_id` int(11) DEFAULT NULL,
`detail` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@Stanton
Stanton / gist:1200794
Created September 7, 2011 14:58
image.php
<?php
/**
* image Generator -- see trac ticket #778 and #795
*
* Resizes an image
*
* For proper documentation see the phpdoc for the imageGenerator function.
*/
// If there isn't a directory for cached images, make one.
@Stanton
Stanton / gist:1200781
Created September 7, 2011 14:53
imageGenerator usage
<?php
/* HEADLINE ARTICLE */
if (isset($headline)) :
?>
<div id="headline" class="search_result">
<a href="http://<?php print $DOMAIN . buildNewsArticleURL($headline[0]->id);?>">
<?php
if ($headline[0]->imageURL != "") {
print imageGenerator('http://' . $DOMAIN . '/images/'. $headline[0]->imageURL, array(