Skip to content

Instantly share code, notes, and snippets.

View emjayess's full-sized avatar
💭
🪞 mirroring repos from gitlab

Matthew J. Sorenson emjayess

💭
🪞 mirroring repos from gitlab
View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Conforming XHTML 1.0 Transitional Template</title>
</head>
@emjayess
emjayess / qunit-boilerplate-markup.html
Created May 11, 2011 19:13
QUnit boilerplate markup
<!DOCTYPE html>
<html>
<head>
<title>javascript unit tests...</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css"/>
</head>
<body>
<h1 id="qunit-header">QUnit Sample</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
@emjayess
emjayess / D7-hook_js_alter-example.php
Created March 25, 2011 19:13
include a more up-to-date version of jquery than what ships with Drupal 7 core...
function hook_js_alter(&$js) {
$js['misc/jquery.js']['data'] = drupal_get_path('module', 'jquery_update') . '/jquery.js';
}
@emjayess
emjayess / chunkify.pl
Created March 4, 2011 22:58
one basic approach to chunking/parsing a csv using Text::CSV
#!/usr/bin/perl
# modes
use strict;
use warnings;
# modules
use Text::CSV;
my $csv = 'DATA.TXT';
@emjayess
emjayess / goldfusion.cfm
Created January 22, 2011 20:11
did you ever think coldfusion could achieve such elegance?!
<cfscript>
writeoutput(
stache.render(
$.getTMPL(mustache_path & "navigation.mustache"),
$.getJSON(fixtures_path & "navigation.json")
)
);
</cfscript>
@emjayess
emjayess / jquery.foo.js
Created January 18, 2011 23:34
boilerplate js for jquery plugin authoring
// replace 'foo' with the name of the plugin, etc
(function($){
$.fn.foo = function(opts) {
var settings = $.extend({}, $.fn.foo.defaults, opts);
return this.each(function() {
var $this = $(this);
// plugin code here...
});
};
/*!
* JavaScript whatevCache - v0.2pre - 12/30/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// whatevCache.set( key, value [, ttl ] );
@emjayess
emjayess / mustache-cfc.test.cfm
Created December 28, 2010 23:25
this is going to make my life a little (ok, a lot) easier!...
<cfscript>
// require https://github.com/pmcelhaney/Mustache.cfc
mustache = createobject('component','cfc/mustache');//dump(mustache);
//view template:
hello_templ = '<h1>Hello, {{thing}}</h1>';
//model object:
hello_model = {
thing = 'Mustache'
@emjayess
emjayess / ternary.js
Created December 1, 2010 17:34
javascript's flexible ternary
// the agility of javascript's ternary operation...
// lots of folks don't seem aware of the subsequent assignments available
function ternary(a,b) {
var c,d,tis='';
c = (d = a==b) ? tis='tis true' : tis='tis false';
return [c,d,tis];
}
console.log(ternary(true,true));
console.log(ternary(true,false));
// Cross-browser object.watch and object.unwatch
// object.watch
if (!Object.prototype.watch) {
Object.prototype.watch = function (prop, handler) {
var oldval = this[prop], newval = oldval,
getter = function () {
return newval;
},
setter = function (val) {