Skip to content

Instantly share code, notes, and snippets.

View dmsnell's full-sized avatar

Dennis Snell dmsnell

View GitHub Profile
@dmsnell
dmsnell / instanceConstructor.js
Created January 19, 2016 00:29
Creating an instance of a type class in JavaScript
const l = m => console.log( m );
function Maybe(v) {
this.value = v
}
Maybe.prototype.typeName = 'Maybe'
function Monad() {
this.value = null
@dmsnell
dmsnell / eagerOrLazy.js
Last active January 5, 2016 06:19
What will the following script spit out?
const l = m => console.log( m );
console.clear();
const a = () => { l( 'a ran' ); return 'a'; };
const b = () => { l( 'b ran' ); return 'b'; };
const c = false
? a()
: b();
@dmsnell
dmsnell / IntroToReact-TucsonJS.md
Created November 2, 2015 06:01
Presentation on React for TucsonJS, November 2015

How to React

and why you should


{
  "name": "Dennis Snell",
  "title": "Spline Reticulator",
  "company": "Automattic, Inc.",
@dmsnell
dmsnell / generate-linter-args.php
Last active October 22, 2015 03:28
Generate linter args from SVN repository
#!/usr/local/bin/php
<?php
/**
* Generates a structured list of files related to an
* SVN commit or working directory, or generates the
* diff between a particular SVN commit and its parent
* or between the working directory and the base revision.
*
* Calling:
@dmsnell
dmsnell / webpagetest.org-codefortucson.org.json
Last active September 16, 2015 17:26
Performance test for codefortucson.org webpagetest.org before optimization milestone
{
"log": {
"version": "1.1",
"creator": {
"name": "WebPagetest",
"version": "2.18"
},
"pages": [
{
"startedDateTime": "2015-09-16T03:00:42.000+00:00",
var Immutable = require( 'immutable' );
var initialData,
updatedData,
partialData;
initialData = {
status: 200,
image: {
height: 64,
@dmsnell
dmsnell / generateWebVersions.sh
Last active August 29, 2015 14:24
Automatically generate web versions of high quality TIFF images placed in a given directory (with fswatch)
# Generates varying exports of a TIFF image
# for different web uses: one high quality
# image for Flickr and two scaled-down lower-quality
# versions for posting to blogs, Twitter, etc...
#
# Only operates on TIFF images because I wanted
# to preserve as much quality as I could until the
# end and also because I don't want to allow a loop
# on the output of this file triggering a new run.
#