Skip to content

Instantly share code, notes, and snippets.

@datchley
datchley / gist:6234265
Last active July 1, 2019 02:29
Git pre-commit hook to make sure I don't leave console/debug statements in my code.
#!/bin/sh
#
# @file pre-commit
# @author David Atchley, <david.atchley@answers.com>
# @date Wed Dec 18 14:02:39 CST 2013
#
# Pre Commit checks for various syntax and cleaning prio
# to committing. Exits with non-zero to stop commit
#
#----------------------------------------------------------------------
@datchley
datchley / gist:6215614
Created August 12, 2013 21:48
Remove duplicates from an array of objects in javascript using a function generator.
var data = [{
author: "Stephen King",
title: "It"
}, {
author: "Anne Rice",
title: "Exit to Eden"
}, {
author: "Stephen King",
title: "It"
}, {
@datchley
datchley / jsongrid.html
Created May 4, 2011 15:23
ExtJS 4.0 Json Grid
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!-- Stylesheets to handle CSS -->
<link rel="stylesheet" type="text/css" href="js/extjs/resources/css/ext-all.css" />
<!-- Javascript for the applications -->
<!-- <script type="text/javascript" src="js/extjs/ext-all-debug.js"></script> -->
<script type="text/javascript" src="js/extjs/bootstrap.js"></script>
<script type="text/javascript">
@datchley
datchley / JSM.js
Created February 13, 2011 02:11
A Javascript Module facility, similar to Perl's Modules/Exporter (and JSAN)
// Copyright @2011, David Atchley (david.m.atchley@gmail.com)
/**
* @fileOverview
* <p>
* JSM stands for JavaScript Module, and is based on Perl's module and exporter
* facilities. Combines a number of those ideas from Perl and from the existing
* JSAN facility, though with some slight changes.
* </p>
*
@datchley
datchley / interface-pattern-idea.js
Created January 31, 2011 18:51
An implementation idea for JavaScript interfaces
/**
* @class Interface
* @constructor
* Allows the application of the interface design pattern, by defining
* an interface as a name and set of methods. The methods are given a name
* and a number of arguments. Not type information.
*
* The methods are passed as an array, with one object per method. Each
* method is defined as follows in the methods array:
*