Skip to content

Instantly share code, notes, and snippets.

View wildlyinaccurate's full-sized avatar
🐕‍🦺

Joseph Wynn wildlyinaccurate

🐕‍🦺
View GitHub Profile
@wildlyinaccurate
wildlyinaccurate / workflows.md
Last active August 29, 2015 14:08
Git Workflows

Merge all the things (current workflow for the responsive-news repo)

  1. Branch from develop
  2. Commit as you go
  3. Merge develop into your branch
  4. Push branch, create PR
  5. When branch is ready to merge, merge the PR

Pros

(function() {
'use strict'
var container = document.querySelector('.post-content')
var items = container.querySelectorAll('[data-collection-item]')
[].slice.call(items).forEach(function(item) {
// ...
})
@wildlyinaccurate
wildlyinaccurate / Git.md
Created October 24, 2011 06:53
A comparison of Git and SVN. Or, why you should switch to Git.
   	                                	  ,ad8888ba,   88           
                                   		d8"'    `"8b  ""    ,d     
                                   		d8'                  88     
                                   		88             88  MM88MMM  
                                   		88      88888  88    88     
                                   		Y8,        88  88    88     
                                   		 Y8a.    .a88  88    88,    
                                   		  `"Y88888P"   88    "Y888  
@wildlyinaccurate
wildlyinaccurate / main.sh
Last active October 7, 2015 13:44
Using Docker's save/load commands to share and run images without using a registry
REGISTRY=registry.yourdomain.com
# You may want/need to pull the latest images on a machine which has access to the registry
docker pull $REGISTRY/foo
docker pull $REGISTRY/bar
# You can save the images as tarballs and distribute them as you please
docker save --output=/home/user/images/foo.tar $REGISTRY/foo
docker save --output=/home/user/images/bar.tar $REGISTRY/bar
@wildlyinaccurate
wildlyinaccurate / akamai_not_cacheable_replayer.rb
Created August 1, 2012 13:44
Log replayer that flags URLs where the X-Check-Cacheable header returned by Akamai is NO
=begin
This script will replay an Apache log file and verify whether each request
is cacheable by Akamai.
To run the script, provide the log file and your Akamai origin host name as
arguments, for example:
replayer.rb /var/log/apache/access.log http://dsd-www.example.com.edgesuite-staging.net
=end
require 'net/http'
@wildlyinaccurate
wildlyinaccurate / convert-tabs-and-trim-trailing-whitespace.sh
Last active December 11, 2015 22:59
Convert tabs to 4 spaces and trim any trailing whitespace
# This requires GNU sed (or any sed which supports -i) and expand
find . -type f -printf "sed -i 's/[ \t]*$//' %p && expand -t 4 %p > %p.tmp && mv %p.tmp %p\n" | sh
# It's better to be more specific about which files you want to run the replacement in, e.g.
find . -type f -name *.php -printf "sed -i 's/[ \t]*$//' %p && expand -t 4 %p > %p.tmp && mv %p.tmp %p\n" | sh
# You can use find's -regex option to match multiple extensions (you need to double-escape backslashes in bash):
find . -type f -regex .+\\\.\\\(php\\\|css\\\|js\\\)\$ -printf "sed -i 's/[ \t]*$//' %p && expand -t 4 %p > %p.tmp && mv %p.tmp %p\n" | sh
@wildlyinaccurate
wildlyinaccurate / watch.sh
Last active December 14, 2015 11:58
Simple script to run the CoffeeScript and Sass "watch" commands
#!/bin/bash
PIDFILE=".watch.pid"
touch $PIDFILE || (echo "Unable to write to .watch.pid" && exit 1)
# Kill off old processes
while read pid; do
kill $pid
done < $PIDFILE
@wildlyinaccurate
wildlyinaccurate / hack.sh
Last active December 17, 2015 02:49 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://gist.githubusercontent.com/wildlyinaccurate/5539084/raw/hack.sh | sh
#
@wildlyinaccurate
wildlyinaccurate / Default (Linux).sublime-keymap
Last active December 17, 2015 02:59
My Sublime Text keymap configuration
[
{ "keys": ["ctrl+d"], "command": "duplicate_line" },
{ "keys": ["ctrl+shift+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys" : ["ctrl+shift+down"], "command" : "swap_line_down"},
{ "keys" : ["ctrl+shift+up"], "command" : "swap_line_up"},
{ "keys": ["ctrl+shift+o"], "command": "prompt_open_folder" },
{ "keys": ["ctrl+s"], "command": "save_all" },
{ "keys": ["ctrl+shift+w"], "command": "close_all" }
]
@wildlyinaccurate
wildlyinaccurate / Sublime Packages.txt
Created May 9, 2013 19:32
Packages I use to develop in Sublime Text 3 (PHP, JavaScript, CoffeeScript, SCSS, Ruby, Behat/Gherkin)
All Autocomplete
CoffeeScript
DocBlockr
Markdown Preview
Package Control
Sass
SideBarEnhancements
SublimeCodeIntel
SublimeLinter
SyncedSideBar