Skip to content

Instantly share code, notes, and snippets.

View sixlettervariables's full-sized avatar

Christopher Watford sixlettervariables

View GitHub Profile
@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 / 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 / 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 / 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"