Skip to content

Instantly share code, notes, and snippets.

View sixlettervariables's full-sized avatar

Christopher Watford sixlettervariables

View GitHub Profile
@sixlettervariables
sixlettervariables / optipng-full.bat
Created July 23, 2014 17:18
Batch compression of PNG's with OptiPNG for Windows (non-recursive, same directory)
::
:: Non-recursive OptiPNG batch conversion.
:: Based on http://superuser.com/a/604502
::
:: Caveats: 1. Will reduce colorspace if possible (Color -> Grays)
:: 2. Will overwrite images in-place
::
@echo off
echo.
set apppath="OptiPNG.exe"
@sixlettervariables
sixlettervariables / mogrify-all.bat
Last active August 29, 2015 14:04
Batch thumbnail creation with ImageMagik's mogrify and OptiPNG (non-recursive, needs thumbs directory)
::
:: Non-recursive ImageMagick mogrify thumbnail batch conversion,
:: with OptiPNG compression afterwards.
:: Based on http://superuser.com/a/604502
::
:: Caveats: 1. Will reduce colorspace if possible (Color -> Grays)
:: 2. Will overwrite thumbnails in-place if they exist
:: 3. Requires %1\thumbs to exist
:: 4. Uses 30% of original size, change as you see fit
::
@sixlettervariables
sixlettervariables / cdn-helper.js
Created August 6, 2014 19:19
DustJS Helper: CDN URL Rewriting
/// Copyright (c) 2014 Christopher A. Watford
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
@sixlettervariables
sixlettervariables / sequelize-toPOJO.js
Created August 6, 2014 19:45
Sequelize: toPOJO for DustJS
///var _ = require('lodash');
/** Convert a Sequelize model instance into a true POJO.
*
* This differs from `Instance.toJSON` in that nested instances are
* converted as well.
*
* @param {Object|Array} [instance] Sequelize model instance or instances.
* @return {Object|Array} A plain object version of the instance.
*/
@sixlettervariables
sixlettervariables / router-dump.js
Last active August 29, 2015 14:05
express-enrouten Router Dumper
/** router-dump: Dump the current stack for an expressjs router built with express-enrouten.
* @author Christopher A. Watford <[email protected]>
*/
'use strict';
/* EXAMPLE OUTPUT
[router] GET /login/ (./controllers/login/index.js)
[router] POST /login/ (./controllers/login/index.js)
[router] GET /login/reset/ (./controllers/login/index.js)
@sixlettervariables
sixlettervariables / routify-test.js
Last active August 29, 2015 14:05
Provides Filename to Route hash from a swaggerized directory structure
'use strict';
var fs = require('fs');
var path = require('path');
/* EXAMPLE:
* var routes = routeifyDirectory('./controllers');
* Object.keys(routes).forEach(function (fn) {
* console.log('%s => %s', fn, routes[fn]);
* });
@sixlettervariables
sixlettervariables / enrouten-directory.js
Created August 20, 2014 19:45
Enrouten with swaggerize-express support
/**
* Rewrite of express-enrouten's directory handler to use 'routeify()'
*
*/
'use strict';
var path = require('path');
var express = require('express');
@sixlettervariables
sixlettervariables / silly-windows-versions.md
Last active May 3, 2024 01:42
Why "Windows 10" wasn't chosen because of developers checking "Windows 9"

Why "Windows 10" wasn't chosen because of "braindead" developers checking for Windows 95 or 98.

You may have seen the picture, purporting to have source from a Microsoft developer explaining why Windows had to be versioned 10. The punchline is that so many programmers rely on the version to begin with "Windows 9" if they are running on 95 or 98, that Windows 10 was the only logical choice:

if(version.StartsWith("Windows 9"))
{ /* 95 and 98 */
} else {
@sixlettervariables
sixlettervariables / example-adaro-config.json
Created November 6, 2014 03:28
Example Adaro/Dustjs additional helpers configuration
"view engines": {
"js": {
"module": "engine-munger",
"renderer": {
"method": "js",
"arguments": [
{
"cache": true,
"helpers": [
{

Keybase proof

I hereby claim:

  • I am sixlettervariables on github.
  • I am watford (https://keybase.io/watford) on keybase.
  • I have a public key whose fingerprint is 80A7 B35C 0E00 658A D9D9 8DB7 590D 18D1 7779 BB15

To claim this, I am signing this object: