Skip to content

Instantly share code, notes, and snippets.

View dustinboston's full-sized avatar

Dustin Boston dustinboston

View GitHub Profile
@dustinboston
dustinboston / _index.html
Last active October 29, 2019 00:13
Poor Man's React
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Poor Man's React</title>
<link rel="stylesheet" href="./css/styles.css" />
</head>
<body>
@dustinboston
dustinboston / grunt_do.coffee
Created February 1, 2016 07:12
Publishing workflow for Grunt
fs = require('fs')
# Transform sentence case to a filename
fileize = (date, title, extension) ->
characters = /("|'|!|\?|:|\s\z)/ig
whitespace = /\s/ig
"#{date}-#{title.replace(characters, '').replace(whitespace, '-').toLowerCase()}.#{extension}"
module.exports = (grunt) ->
grunt.initConfig
@dustinboston
dustinboston / local_auth.postman_collection.json
Created May 8, 2015 23:01
Postman collection for local auth with angular-fullstack Yeoman generator
{
"id": "e0ff964f-6dd8-6c2a-1444-6afa58ff1500",
"name": "Local Auth",
"description": "",
"order": [
"1e7c070f-2ad5-a777-8aea-da9e4a1b75bf",
"4423ded8-e38e-d852-9dd6-9177368e6d09"
],
"folders": [],
"timestamp": 1431125920517,
@dustinboston
dustinboston / post-receive.sh
Last active August 29, 2015 14:08
Git push-to-deply post-receive hook
#!/bin/sh
# $HOME/opt/git/example.git/hooks/post-receive
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
#
@dustinboston
dustinboston / fastest_fizzbuzz.js
Created September 5, 2013 22:22
The fastest JavaScript fizzbuzz I've seen. Ported from https://gist.github.com/ggilder/2893724, which also explains what's going on.
var acc = 810092048;
var aMillion = 1000000;
var number = 1;
var log = function(value) {
console.log(value);
};
function bitwiseFizzBuzz(i) {
var c = acc & 3, a = 'fizzbuzz';
@dustinboston
dustinboston / overloaded.coffee
Created July 16, 2013 10:46
MVC where the controller is a mediator and the views are both observers and colleagues.
class List
constructor: () ->
# A list of pointers
@items = []
# Objects passed in by pointer
@objects = {}
# Returns the number of objects in the list
count: () ->
@dustinboston
dustinboston / story_time.html
Last active December 19, 2015 00:58
The definitive format for user stories. Add as many scenarios as needed.
<!DOCTYPE html>
<html ng-app="storyTime">
<head>
<title>Story time</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<style>body {padding: 50px;} .navbar .brand {margin-left: 0;}</style>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script>
macro python {
// Print
case print $params (,) ... => {
console.log(( $params (,) ... ))
}
// Function definition
case def $name:ident ( $params (,) ... ) : $a $b ... => {
function $name( $params (,) ... ) { python $a $b ... }
}
// Function call
@dustinboston
dustinboston / common-media-queries.css
Created October 10, 2012 18:29
Common Media Queries
/* This is a small sampling of the various approaches to media queries. The
point is: they're all over the board. Part of the "issue" (if you can call
it that) may be due to the intended audience of each site/framework. Another
may be that it's really difficult to test for a lot of different devices.
Regardless, it would be really nice if there was standard baseline that
could be used as a starting point for maximum compatibility and coverage. */
/* ==========================================================================
Frameworks
========================================================================== */
@dustinboston
dustinboston / xrayquire_tree.js
Created August 14, 2012 18:14
Generate dependency tree for RequireJS apps with xrayquire
xrayquire = {
// ...
getTree: function (contextName) {
var context = requirejs.s.contexts[contextName || '_'],
xray = getX(context),
traced = xray.traced,
tree = {};
sortTraceOrder(xray.traceOrder);