Skip to content

Instantly share code, notes, and snippets.

View cabbiepete's full-sized avatar

Peter Simmons cabbiepete

View GitHub Profile
@mping
mping / page.html
Created October 14, 2010 14:37
xhtmlrenderer (Flying Saucer) with css3 header/footer
<link href="print.css" rel="stylesheet" type="text/css" media="screen,print"/>
...
<div style="-fs-page-sequence: start; page-break-before: always">
<div style="position: running(current);">
<div id="page-header" class="small">
<span class="align-left">some stuff here</span>
<span class="align-right">some other stuff here</span>
<div class="line">&#160;</div>
@cabbiepete
cabbiepete / mysql2sqlite.sh
Created June 7, 2012 02:38 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@clintconklin
clintconklin / gist:7393526
Last active February 6, 2017 15:12
Optimizing multiple files with grunt via grunt-contrib-requirejs: http://blog.clintconklin.com/optimizing-multiple-javascript-files-with-grunt-and-requirejs/
module.exports = function(grunt) {
var matches = grunt.file.expand('scripts/template-scripts/**/index.js');
var requirejsOptions = {};
if (matches.length > 0) {
for (var x = 0; x < matches.length; x++) {
var path = matches[x].replace(/\/index\.js/, '');
requirejsOptions['task' + x] = {
"options": {
"baseUrl": "./",
@medmunds
medmunds / README.md
Created March 29, 2016 02:32
Taking back your Mandrill click-tracking links

Taking back your Mandrill click-tracking links

My company, like many, has recently switched away from using Mandrill for our transactional email.

We'd been using Mandrill's [click-tracking][mandrill-click-tracking] feature, and became worried about what would happen to all those old emailed links after we cancel our Mandrill account.

Why should we care about links in emails sent a month or more ago?

@mikermcneil
mikermcneil / async-if.js
Last active March 31, 2017 23:13
What about async.if()? What if you need to take an asynchronous detour? Or to do something asynchronous under some circumstances, but something synchronous under others?
// Whether you're building a Sails app, working with Waterline or Node Machines in a standalone Node.js project,
// or frankly doing anything asynchronous in Node.js, it's pretty common to end up in a situation where you need
// to do something asynchronous... but only in some cases! This gist shows a couple of ways to handle that.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// ╔═╗╦ ╦╔╗╔╔═╗╦ ╦╦═╗╔═╗╔╗╔╔═╗╦ ╦╔═╗ ┌─ ┌┬┐┬─┐┌─┐┌┬┐┬┌┬┐┬┌─┐┌┐┌┌─┐┬ ─┐
// ╚═╗╚╦╝║║║║ ╠═╣╠╦╝║ ║║║║║ ║║ ║╚═╗ │ │ ├┬┘├─┤ │││ │ ││ ││││├─┤│ │

The Story of NPM and Yarn

In the beginning there was NPM, and for a time it was good. Packages went forth and multiplied. The New Gods proclaimed the great demon Dependency Management had been slain. But The Old Gods knew better, for they had seen much and knew that the demon can never be killed, only held at bay.

The Old Gods were ignored. In the folly of a young age grew an abundance of packages and with them grew the scourge of dependency. In the depths beneath the earth, in a place beyond memory, the great demon stirred.

The first sign something was wrong was non-deterministic package version mismatches. “This is fine!” The New Gods declared. “A temporary setback, nothing more! We can fix it.” And so they introduced shrinkwrap, a lamp to combat the growing darkness.

But it proved to be too little, too late, and dusk continued to fall. The New Gods suffered their first major defeat at the [Battle of Left-pad](https://www.theregister.co.uk/2016/03/23/npm_left_