Skip to content

Instantly share code, notes, and snippets.

View mhulse's full-sized avatar
👋
👁 ❤️ open source software …

Michael Hulse mhulse

👋
👁 ❤️ open source software …
  • Instructure Inc.
  • Eugene, Oregon
View GitHub Profile
@omgmog
omgmog / jquery_disqus_lazyload.js
Created April 5, 2012 13:19 — forked from muratcorlu/jquery_disqus_lazyload.js
Load disqus comments when visitor scroll down page to comments
/**
* Load disqus comments when visitor scroll down page to comments
*
* Usage:
* Add a div with id "disqus_thread" and data attributes for every disqus parameter:
*
* <div id="disqus_thread" data-disqus-shortname="username" data-disqus-url="http://example.com/post/post-name/"></div>
*
* @author: Murat Corlu
* @link: https://gist.github.com/gists/2290198
@mbrochh
mbrochh / install_venv.sh
Created February 5, 2014 15:32
Installing virtualenvwrapper on Webfaction
#!/bin/bash
PYTHONVER=2.7
PYTHON=python${PYTHONVER}
mkdir -p $HOME/{bin,tmp,lib/$PYTHON}
easy_install-${PYTHONVER} pip
pip2.7 install virtualenv --no-use-wheel
pip2.7 install --install-option="--user" virtualenvwrapper --no-use-wheel
# Update $HOME/.bashrc with appropriate environment variables
echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.bashrc
@tako2
tako2 / theta360.py
Created December 1, 2013 14:13
Controlls RICOH THETA 360 (Python).
#!/usr/bin/env python
# coding: UTF-8
import socket
import struct
DEBUG = True
DEBUG2 = False
PTP_OC_GetDeviceInfo = 0x1001
@liamcurry
liamcurry / html5video.sh
Created May 14, 2012 20:24 — forked from markupboy/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
# Output file for HTML5 video
# requirements: ffmpeg .6+
# usage: ./html5video.sh infile.mp4 640x360
target_directory='converted'
file=`basename $1`
filename=${file%.*}
filepath=`dirname $1`
@michaelsanford
michaelsanford / bash_colours.sh
Last active November 21, 2019 23:38
Bash colour code quick reference
#!/usr/bin/env bash
####
# Invoke with
# $ bash_colours [limit]
###
if hash tput >/dev/null 2>&1; then
bound=${1:-255}
for (( i = 0; i < bound; i++ )); do
@coolaj86
coolaj86 / gist:2332953
Last active April 2, 2020 04:17
Dimensions for VistaPrint business cards
Standard
Bleed Margin: 90mm x 52mm
Content Ends: 87mm x 49mm
Imperial
Bleed Margin: 3.54in x 2.05in
Content Ends: 3.43in x 1.93in
@eteubert
eteubert / abstract-example.php
Created October 31, 2011 11:07
WordPress: Customize Page & Post Metaboxes
<?php
$wp_meta_boxes[ 'post' ][ 'normal' ][ 'core' ][ 'post excerpt' ][ 'title' ] = 'Abstract';
$wp_meta_boxes[ 'post' ][ 'normal' ][ 'core' ][ 'post excerpt' ][ 'id' ] = 'postabstract';
@stefanofiorentino
stefanofiorentino / gist:aa0e76dadfd1fdb0cb0267c28363e306
Created November 7, 2019 16:47
c/c++ function to translate RGB bash terminal colot
// based on https://gist.github.com/mhulse/b11e568260fb8c3aa2a8
void UserLedManager::print_terminal_background_color(const int &r, const int &g, const int &b) const
{
auto r_weight = r < 75 ? 0 : (r - 35) / 40;
auto g_weight = g < 75 ? 0 : (g - 35) / 40;
auto b_weight = b < 75 ? 0 : (b - 35) / 40;
int status = (r_weight * 6 * 6 + g_weight * 6 + b_weight + 16);
fprintf(stdout, "\e[48;5;%dm %3d \e[0m", status, status);
fflush(stdout);
}
@chrisjacob
chrisjacob / README.md
Created July 16, 2011 11:23
How to: GitHub Pages "gh-pages" branch for User & Organization Pages

GitHub Pages "Normal" Setup for User & Organization Pages

Let’s say your GitHub username is “alice”. If you create a GitHub repository named alice.github.com, commit a file named index.html into the master branch, and push it to GitHub, then this file will be automatically published to http://alice.github.com/... The same works for organizations.

Read more here: http://pages.github.com/

However... the downside of this is that anyone that forks this repo won't get it as a GitHub Pages repo when they are working on it... because they have a different GitHub "username" (or "organisation name").

So the trick is to not use a master branch as the documentation tells you... rather, use a gh-pages branch, as you would for your other "Project Pages".

@mhulse
mhulse / javascript-plugin-patterns-FOUND-protoytpe-newed.js
Last active May 16, 2021 14:45
Some of my favorite JavaScript plugin design patterns: The Facade Pattern, The Revealing Module Pattern, Immediately-invoked Function Expressions (IIFE)s, The Module Pattern imports and exports
// http://callmenick.com/post/slide-and-push-menus-with-css3-transitions
(function(window) {
'use strict';
/**
* Extend Object helper function.
*/
function extend(a, b) {