Skip to content

Instantly share code, notes, and snippets.

@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@topliceanu
topliceanu / micro-mustache.js
Created December 30, 2011 04:22
John Resig's Micro Template with changed tags from <%=, %> into more mustache-esque {{= and }}
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
@phpfunk
phpfunk / alias.sh
Last active May 2, 2017 18:42
A command line PHP script to merge a git branch into multiple other git branches.
### Alias
alias gam='php /path/to/auto-merge.php'
@thom4parisot
thom4parisot / README.md
Last active December 4, 2017 02:46
Downloading daily archives of an Instagram Hashtag.

Instagram Hashtag Archiver

This script helps you to download locally the latest pictures related to a specific Instagram hashtag. It will fetch them and add them in a daily folder (like 2013-8-16 for the 16th of August 2013).

No resume feature. No extra metadata. No OAuth pain.

Install

@thirdender
thirdender / script.js
Created September 6, 2013 17:42
Make the Next and Previous navigation reload the main section of a page using jQuery.load. history.pushState is used to keep the URL in the location bar up to date, and the loading of the content is done with a touch of animation.
// History logic: http://adhockery.blogspot.com/2011/02/javascripts-history-object-pushstate.html
if (history.pushState) {
var selector = "#main",
loadSelector = " " + selector + " > *",
container = $(selector).on("click", "nav[role='pagenavigation'] a", function() {
var href = $(this).attr("href");
$("html, body").animate({ "scrollTop": 0 }, 400);
history.pushState({ "path": href }, null, href);
container.
animate({ "opacity": 0 }, 400).
@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2024 19:02
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@phpfunk
phpfunk / backup-overview.md
Last active November 28, 2016 17:59
Back That Thang Up (Backing up Your Backups)

So you are making backups? That's good news, but are your backups backed up? As a good rule of thumb I back everything up to a network drive, then that network drive backs up to another drive and is also shipped to Backblaze for an offsite copy. Backblaze doesn't support network drives so I have them hooked up to an older mac mini that I use as a server. Backblaze is only $5/month for unlimited data, so you really can't lose there.

I always mirror my backup internally for when that drive fails and evenutally it will. That way I have a copy to swap out while I get another drive. Backblaze is used for total data loss. If all drives fail or burn up, are stolen, what have you; I will still have my data.

Yes I could use a RAID to mirror

@mason-stewart
mason-stewart / rollout.sh
Created August 29, 2014 17:31
Roll out.
#!/bin/bash
open -a Google\ Chrome "https://www.youtube.com/watch?v=mjqn6j2VM2U"
sleep 16
say "roll out"
sleep 0.8
say "roll out"
sleep 0.8
say "roll out"
sleep 0.8