Skip to content

Instantly share code, notes, and snippets.

View danheberden's full-sized avatar

Dan Heberden danheberden

View GitHub Profile
@danheberden
danheberden / finddata.jquery.js
Created June 27, 2011 14:21
findData plugin - search by data-KEY=VALUE on and in current jQ collection
/*
* by Dan Heberden / 2011
* demo at http://jsfiddle.net/danheberden/VjKMY/
* made just for Elijah Manor
* e.g.
* $( 'div' ).findData( 'theDataKey', 'theValue' );
*
* will search in the divs and their children
*/
(function( $ ){
var cloud = '',
users = {};
$('.js-comment-container').each(function() {
var c = $(this),
author = c.find('.author .author a').text(),
body = c.find('.content-body').text(),
words = body.split(' ').length;
users[ author ] = users[ author ] || 1;
@danheberden
danheberden / gist:1169967
Created August 25, 2011 04:12
coffeescript jsfiddle parser
(function(){
var s = "script",
n = "\n",
d = document,
tag = d.getElementsByTagName( s );
console.log( s,n,d,tag);
(function parseCoffee() {
console.log( 'running' );
// check for a non-src'd script
@danheberden
danheberden / snippet.htm
Created November 11, 2011 21:02
jQuery Include Snippet
<script>
(function(){
// Look for a jqversion query parameter and grab any following version.
// Limit to digits and letters to prevent any XSS attempts
var verMatch = /jqversion=([\w\.]+)/.exec( location.search ),
// our matched version, e.g., 1.6.4 or 1.7rc1
version = verMatch && verMatch[1],
src;
if ( version ) {
// version was specified, use jQuery's CDN to acccess non-mininfied betas and RCs
var verMatch = /jqversion=([\w\.]+)/.exec( location.search ),
version = verMatch && verMatch[1];
if ( version ) {
document.write( '<script src="//code.jquery.com/jquery-' + version + '.js"><\/script>' );
} else {
document.write( '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><\/script>' );
}
document.write( '<script src="//code.jquery.com/jquery-' + version + '.js"><\/script>' );
var version = verMatch && verMatch[1];
var verMatch = /jqversion=([\w\.]+)/.exec( location.search );
<script>(function(){var a=/jqversion=([\d\w\.]+)/.exec(location.search),b=a&&a[1],c;if(b){c="code.jquery.com/jquery-"+b}else{c="ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min"}document.write('<script src="//'+c+'.js"><\/script>')})()</script>
<script>window.jQuery||document.write('<script src="/scripts/jquery-1.7.0.min.js"><\/script>' )</script>
#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
PID_DIR=/var/run/php-fastcgi
PID_FILE=/var/run/php-fastcgi/php-fastcgi.pid
RET_VAL=0
case "$1" in