Skip to content

Instantly share code, notes, and snippets.

View chauncey-garrett's full-sized avatar

Chauncey Garrett chauncey-garrett

View GitHub Profile
@chauncey-garrett
chauncey-garrett / how-to-set-up-stress-free-ssl-on-os-x.md
Created August 18, 2016 16:47 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

#!/bin/bash
# [email protected]
SSHCONFIG_Linux=$(cat << 'HERE-DOC'
Host *
StrictHostKeyChecking no
ServerAliveInterval 60
ForwardAgent yes
ServerAliveCountMax 4
copy() {
if [[ $1 =~ ^-?[hH] ]]; then
echo "Intelligently copies command results, text file, or raw text to"
echo "OS X clipboard"
echo
echo "Usage: copy [command or text]"
echo " or pipe a command: [command] | copy"
return
fi
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools
# Install dependencies
apt-get install automake libtool
# Fetch sources
git clone https://github.com/sass/libsass.git
git clone https://github.com/sass/sassc.git libsass/sassc
# Create configure script
<head>
<!-- Foundation CSS CDN -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/foundation/5.0.2/css/foundation.min.css">
<!-- Modernizr CDN -->
<script src="//cdn.jsdelivr.net/foundation/5.0.2/js/vendor/custom.modernizr.js"></script>
<!-- Modernizr local fallback -->
<script>window.Modernizr || document.write('<script src="/local/custom.modernizr.js"><\/script>')</script>
</head>
<body>
<!-- APP CONTENT -->
-- Author: Michael Bianco <http://mabblog.com/>
-- Some help from: http://discussions.info.apple.com/message.jspa?messageID=10363317
on create_vpn_service(vpn_name)
tell application "System Preferences"
reveal pane "com.apple.preference.network"
activate
tell application "System Events"
tell process "System Preferences"
@chauncey-garrett
chauncey-garrett / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Ryan Morrissey
#
# 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