Skip to content

Instantly share code, notes, and snippets.

View davidhemphill's full-sized avatar
🏠
Working from home

Hemp davidhemphill

🏠
Working from home
View GitHub Profile
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@marcedwards
marcedwards / high-dpi-media.css
Last active April 22, 2026 09:38
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 5, 2026 02:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@oodavid
oodavid / README.md
Created March 26, 2012 21:21
Restore MySQL from Amazon S3

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@paulnicholson
paulnicholson / powssl
Last active June 6, 2025 19:19
ssl with pow using stud

Instructions

  • Install stud $ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
  • Download and install the powssl script $ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl $ chmod +x ~/bin/powssl
  • Run powssl to create development certificate and configure stud.
  • $ powssl
@cmer
cmer / cjax.js.coffee
Created March 9, 2012 20:54
CJAX - History.js-PJAX hybrid that doesn't suck in IE
# This is a work in progress. I use it in production and it works very well, but use at your own risk!
@initCJAX = () ->
History = @History
$ = @jQuery
document = @document
return false unless @History.enabled
$ ->
contentSelector = ".main"
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@j-mcnally
j-mcnally / pg.php
Created August 18, 2011 01:13
CodeIgniter Permalink Routing
<?php
//would be controllers/pg.php
class pg extends Controller {
var $pgItem;
var $parentPage;
function pg() {
//do some constructor related stuff here
}
function permalink($segments) {
@ChrisMBarr
ChrisMBarr / includeCSS.js
Last active September 26, 2015 12:47
Add a CSS stylesheet to the head of a document
$.extend({
includeCss: function(cssLink, isPrint, callbackFn) {
var $head = $("head");
//Make sure it's a valid string and not already included in the head
if (typeof cssLink === "string" && cssLink.length > 1 && $head.find("link[href='" + cssLink + "']").length <= 0) {
//Create a new link element
var $newLinkTag;
var mediaType = (isPrint) ? 'print' : 'all';
//Needed for IE8 and lower