Skip to content

Instantly share code, notes, and snippets.

View cmattoon's full-sized avatar

Curtis Mattoon cmattoon

View GitHub Profile
@cmattoon
cmattoon / gist:6241862
Created August 15, 2013 15:38
Update Google Analytics when browser orientation changes.
function checkOrientation() {
var w,o,t;
w = window;
o = (w.innerWidth > w.innerHeight) ? 'landscape' : 'portrait';
t = _gat._getTrackers()[0];
if (typeof(w.gao) == 'undefined') {
w.gao = o;
} else {
if (w.gao != o) {
@cmattoon
cmattoon / jsRespond
Created August 28, 2013 19:42
Simple function to call JavaScript functions based on window.innerWidth Usage: jsRespond(max_width, callback) or jsRespond(min_width,max_width,callback)
function jsRespond() {
var min_width, max_width, callback,arglen,width;
arglen = arguments.length;
width = window.innerWidth;
if (arglen == 2) {
min_width = 0;
max_width = arguments[0];
callback = arguments[1];
} else if (arglen == 3) {
@cmattoon
cmattoon / FontAwesome SASS-SCSS Variable List
Created March 7, 2014 15:11
FontAwesome SASS-SCSS Variable Declarations
/* FontAwesome Variable List
*
* Usage:
* .input.username {
* &:before {
* font-family: $icon-font;
* content: $fa-user;
* }
* }
*/
@cmattoon
cmattoon / FontAwesome Content Grabber
Created March 7, 2014 15:13
Script to pull FontAwesome "content" values.
var icons = {};
var ignore = ['fa-lg', 'fa-fw', 'fa'];
$('.container i.fa').each(function() {
var val, icon_name, icon_value, i;
val = window.getComputedStyle($(this).get(0), ':before').getPropertyValue('content');
icon_name = $(this).attr('class').split(' ')[1];
console.log(icon_name);
charcode = val.charCodeAt(0).toString(16);
icons[icon_name] = charcode;
#!/bin/bash
if [ ! -z "$1" ]; then
if [ ! -d "$1" ]; then
mkdir "$1"
mkdir "$1/bin"
mkdir "$1/docs"
mkdir "$1/tests"
mkdir "$1/$1"
touch "$1/README.md"
from fabric.api import *
env.roledefs = {}
env.passwords = {}
def patch_ssl():
sudo('apt-get update')
sudo('apt-get install openssl1.0.0 -y')
sudo('/etc/init.d/apache2 restart')
@cmattoon
cmattoon / gist:3f55ae9f544783867adb
Created December 20, 2014 19:13
one-line webserver
python -m SimpleHTTPServer 80
@cmattoon
cmattoon / GitlabFullscreen.js
Last active May 27, 2016 11:37
Inject fullscreen button into GitLab diffs
// ==UserScript==
// @name GitLab Fullscreen Diffs
// @version 0.1
// @description Adds a 'fullscreen' button to GitLab diffs.
// @match http://*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==
/**
* Be sure to change the @match param above to suit your needs.
@cmattoon
cmattoon / emacs-web-mode.sh
Last active October 16, 2023 12:44
Easy install emacs web-mode
#!/bin/bash
## INSTALL:
##
## 1A) git clone <GIT_URL> web_mode_gist && cd web_mode_gist
## OR
## 1B) wget <RAW_URL>
## 2. chmod +x emacs-web-mode.sh
## 3. ./emacs-web-mode.sh
##
EMACS="${HOME}/.emacs"
@cmattoon
cmattoon / dot-screenrc
Created February 10, 2015 18:36
~/.screenrc file
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W\}%c %{g}]'