Skip to content

Instantly share code, notes, and snippets.

@brianleroux
brianleroux / https-redir-middleware.js
Created April 20, 2017 17:48
express middleware for redirecting to http if a request to nginx came in from http
module.exports = function HTTPSRedirect(req, res, next) {
var env = process && process.env && process.env.NODE_ENV
if (env !== 'production' || req.headers['x-forwarded-proto'] === 'https' || req.url === '/health') {
next()
}
else {
res.redirect('https://' + req.hostname + req.url);
}
}
@jed
jed / plaque.md
Last active August 29, 2015 14:15
BrooklynJS "Sweet 0x10" Commemorative Plaque

[UPDATE] WE SOLD 'EM ALL, RAISING $2,625 for SCRIPTED!

It took a few months, but our experiment of upcycling our unused tokens into fundraising keepsakes finally paid off! It accomplished a whole lot of win in one fell swoop:

  • Creating a physical commemoration of the awesomeness that has been the NYC JavaScript community over the past two years.
  • Raising $2,625 for [ScriptEd][], a NYC-based organization that does amazing work in the local tech community.
  • Increasing BrooklynJS ticket availability through reserved ticket bundling.
  • Letting me work on a creative physical project with my pals @brianloveswords, @kosamari, and @philduffy.
  • Taking bags and bags of unused tokens out of my tiny Brooklyn walkup closets.
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 25, 2024 13:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results