Skip to content

Instantly share code, notes, and snippets.


David Boyer misterdai

View GitHub Profile
View gist:5c0581a1e7c58f324d69c6bebe060b07
search(query: "language:JavaScript stars:>100 created:>2017-05-20 sort:stars-asc", type: REPOSITORY, first: 10) {
edges {
node {
... on Repository {
stargazers {
misterdai / youtube.cfm
Last active Oct 30, 2015
Youtube cfm?
View youtube.cfm
urls = [
misterdai / youtube.js
Created Oct 29, 2015
Youtube validate and ID grab
View youtube.js
var urls = [
misterdai /
Created Nov 6, 2014
ES6, Traceur, Node.js, Harmony
ES6 Feature Node Flag Traceur Flag
generators (yield) --harmony_generators true --generators parse
octal and binary literals --harmony_numeric_literals true --numeric_literals parse
Map, Set, WeakMap, WeakSet --harmony_collections true ???
block-level function declaration ??? ???
Promise Dummy Flag ???
misterdai / index.js
Created Jul 16, 2014
View index.js
var debug = require('debug')('metalsmith-permalinks');
var moment = require('moment');
var path = require('path');
var slug = require('slug-component');
var substitute = require('substitute');
var basename = path.basename;
var dirname = path.dirname;
var extname = path.extname;
var join = path.join;
View myapp.xml
<startargument>-p c:\nginx</startargument>
<stopargument>-p c:\nginx -s stop</stopargument>
misterdai /
Created Oct 16, 2013
Considering approaches of laying out code and handling callbacks. Which one would you pick? getData1, getData2 or getData3?... Or some other method?
request = require 'request'
class Test
_processData: (details, callback, error, response, body) =>
if error?
return callback error
if reponse.statusCode isnt 200
return callback(new Error(response.statusCode))
callback null, {data: JSON.parse(body), details: details}
misterdai / application.cfc
Created Nov 21, 2012
Just a test for use within wordpress (oooh that rhymes :P)
View application.cfc
<cfcomponent output="false">
<cffunction name="onError">
<cfargument name="exception" required="true" />
<cfargument name="eventName" type="string" required="true" />
<cfif StructKeyExists(arguments.exception, 'rootcause')
And StructKeyExists(arguments.exception.rootCause, 'type')
And arguments.exception.rootCause.type Eq 'coldfusion.runtime.AbortException'>
<!--- CF7: Work around for CfAbort and CfLocation causing this to run --->
<cfreturn />
misterdai / bookmarklet
Created Sep 19, 2012
Bookmarklet do remove blank code lines and turn comments into tooltips.
View bookmarklet
javascript:(function(){$('.gist .line br').each(function(){if($(this).siblings().length==0){$(this).parent().remove();}});$('.c, .cm, .c1, .cs','.gist').each(function(){var el=$(this);var parent=el.parent();if(el.siblings().length > 0){var comment=parent.attr('data-comment');comment=(typeof comment==='undefined')%3F'':(comment+'\n');parent.attr('data-comment',comment+el.text());el.remove();}else{var;var comment=parent.attr('data-comment');comment=(typeof comment==='undefined')%3F'':(comment+'\n');nextParent.attr('data-comment',comment+el.text());parent.remove();}});$('html > head').append('<style>*[data-comment] {position:relative; background-color:%23dfd;} *[data-comment]:hover {background-color: %23efe;} *[data-comment]:after, *[data-comment]:before {content:""; opacity:0; z-index:999;} *[data-comment]:hover:after, *[data-comment]:focus:after {opacity:0.94; display:block; content:attr(data-comment); position:absolute; bottom:25px; padding:3px; background:%23efe; border:2px solid %23
View filler.js
$('input[type=text],textarea').each(function() {$(this).val(Math.random().toString(36).substring(3))});
$('select').each(function() {
var el = this;
if (el.multiple) {
$('option', el).each(function() {
this.selected = (Math.random() > 0.5);
} else {
You can’t perform that action at this time.