Skip to content

Instantly share code, notes, and snippets.

View mimetaur's full-sized avatar

Nathan Koch mimetaur

View GitHub Profile
# printf "\033[0m0 All attributes off\033[0m\n"
# printf "\033[1m1 Bold\033[0m\n"
# printf "\033[4m4 Underline\033[0m\n"
# printf "\033[5m5 Blink\033[0m\n"
# printf "\033[7m7 Invert\033[0m\n"
# printf "\033[8m8 Hide\033[0m8 = Hide\n"
# printf "\033[30m30 Black\033[0m30 = Black\n"
# printf "\033[31m31 Red\033[0m\n"
# printf "\033[32m32 Green\033[0m\n"
# printf "\033[33m33 Yellow\033[0m\n"
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active May 29, 2024 00:03
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
@mcculloughsean
mcculloughsean / compile-coffeescript.watchr
Created November 27, 2010 00:57
Compiles coffeescripts to js in the background, preserving directory structure
# Run me with:
# $ watchr compile.watchr
# --------------------------------------------------
# Rules
# --------------------------------------------------
watch( '^Resources/cs/(.*\.coffee)' ) { |m| coffee m }
# --------------------------------------------------
@mbostock
mbostock / .block
Last active November 14, 2023 03:46
Google Maps + D3
license: gpl-3.0
@sansumbrella
sansumbrella / DateUtils.cpp
Created April 24, 2011 05:35
A sane way to format dates from boost. Simple interface, no noodling with stringstreams and locales.
//
// DateUtils.cpp
// Created by David Wicks on 4/23/11.
#include "DateUtils.h"
#include <sstream>
using namespace boost::gregorian;
using namespace std;
@paulirish
paulirish / rAF.js
Last active July 19, 2024 19:50
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@kentwidman
kentwidman / gist:6940117
Last active December 25, 2015 07:29
Password protected .htaccess allowing Facebook Crawler access
SetEnvIfNoCase User-Agent .*google.* search_robot
Order Deny,Allow
Deny from All
Allow from env=search_robot
#password
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/.htpasswd
@kylemcdonald
kylemcdonald / pr-log.py
Last active August 18, 2018 23:06
Probe request MAC/SSID pair logging with tcpdump and Python3 for OS X, using airport for channel hopping.
import re
import pickle
from threading import Timer
import subprocess
from subprocess import call
import os.path
import sys
# config
database = 'allPairs.p'
@bbengfort
bbengfort / lsys.py
Last active August 16, 2023 06:03
Draw an L-System with Python's turtle graphics library, where the L-System is defined with a turning angle (d) a line length (l) and an axiom in the using the characters 'F', 'f', '+', and '-' to indicate rules. You can also iterate the axiom for fractal like patterns.
#!/usr/bin/env python
import turtle
D = 90
L = 10
def iterate(axiom, num=0, initator='F'):
"""
Compute turtle rule string by iterating on an axiom
@indefinit
indefinit / of-bundle-app.md
Last active September 20, 2017 20:54
Openframeworks: bundle app resources inside packaged contents

So you want to bundle your openframeworks app and not have to worry about that pesky "data/" directory... follow this stack overflow article:
http://stackoverflow.com/questions/4882572/how-to-bundle-an-openframeworks-application-in-xcode-relative-resource-linking

TLDR: First you need to tell xCode to copy your /bin/data directory into your application bundle by adding a build phase:

  1. Click on your project in the Project Navigator
  2. Select "Build Phases"
  3. Toggle open the "Run Script" section and paste in the following: