Skip to content

Instantly share code, notes, and snippets.

View caleb531's full-sized avatar

Caleb Evans caleb531

View GitHub Profile
@caleb531
caleb531 / # grep - 2017-07-19_17-10-37.txt
Created July 20, 2017 00:20
grep on macOS 10.12.5 - Homebrew build logs
Homebrew build logs for grep on macOS 10.12.5
Build date: 2017-07-19 17:10:37
@caleb531
caleb531 / get_vhost_url.py
Last active July 20, 2017 03:21
Easily open the local Apache virtual host for the current directory in your default browser; written for MAMP on macOS but can be applied to any local Apache installation
#!/usr/bin/env python3
import os
import os.path
import re
import sys
# Retrieve the name/args of a directive like DocumentRoot or <VirtualHost>
def get_vhost_directive(vhost_line):
@caleb531
caleb531 / add_cert.sh
Last active March 11, 2020 18:58
Scripts for creating and managing simple SSL certificates on macOS (useful for local HTTPS)
#!/usr/bin/env bash
cert_file="$1"
key_file="$2"
CERT_CONF="$(dirname "${BASH_SOURCE[0]}")"/cert-conf.cfg
if [ ! -f "$cert_file" ]; then
cert_hostname="$3"
@caleb531
caleb531 / keybase.md
Created September 12, 2016 17:05
The public proof of my identify (via Keybase)

Keybase proof

I hereby claim:

  • I am caleb531 on github.
  • I am caleb531 (https://keybase.io/caleb531) on keybase.
  • I have a public key ASAI6xsHZvGbWf7I7B0x7bHsDERNDBrDZ1nNWX2bQGHr2Ao

To claim this, I am signing this object:

@caleb531
caleb531 / qunit-shallowequal.js
Last active January 2, 2016 23:48
A shallowEqual() assertion for QUnit, which is essentially a strict comparison of all top-level properties for each object (ignoring the prototype chain).
// Determines if two objects are equal (ignoring prototypes)
QUnit.shallowEquiv = function(actual, expected) {
var key, equiv = true;
// Compare first object to second object
for (key in actual) {
// Keys must not be in prototype chain
if (actual.hasOwnProperty(key)) {
if (actual[key] !== expected[key]) {
equiv = false;
break;
@caleb531
caleb531 / snap-to-grid.js
Last active May 21, 2018 08:37
Makes a jCanvas layer draggable along a defined grid
// Available in jCanvas v20.1.0
// The pixel multiple to snap to
var snapToAmount = 40;
// Round the given value to the nearest multiple of n
function nearest(value, n) {
return Math.round(value / n) * n;
}
$('canvas').drawArc({
layer: true,