Skip to content

Instantly share code, notes, and snippets.

View wildlyinaccurate's full-sized avatar
🐕‍🦺

Joseph Wynn wildlyinaccurate

🐕‍🦺
View GitHub Profile
@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
@wildlyinaccurate
wildlyinaccurate / rebase1
Created May 21, 2013 13:50
Complete the `rebase1` level of Learn Git Branching in 6 moves - http://pcottle.github.io/learnGitBranching/
git checkout another
git rebase side
git rebase bugFix
git rebase master
git checkout master
git rebase another
@wildlyinaccurate
wildlyinaccurate / xranr-force-resolution.sh
Created September 27, 2013 14:49
Force X to use a certain screen resolution
# Ad-hoc
xrandr --newmode 1920x1080 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VBOX0 1920x1080
xrandr --output VBOX0 --mode 1920x1080
# Or in ~/.i3/config
# exec_always xrandr --newmode 1920x1080 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
# exec_always xrandr --addmode VBOX0 1920x1080
# exec_always xrandr --output VBOX0 --mode 1920x1080
@wildlyinaccurate
wildlyinaccurate / monitor-concurrent-commands.sh
Created October 3, 2013 08:56
A simple way of checking the exit code of commands which have been run concurrently.
sleep_times=('4' '1' '2' '5' '0')
pids=()
for sleep_time in ${sleep_times[@]}
do
sleep $sleep_time &
pids=(${pids[@]} $!)
done
for pid in ${pids[@]}
@wildlyinaccurate
wildlyinaccurate / add.js
Created February 7, 2014 08:51
Bitwise addition
// Fuck the addition operator. Real programmers work in binary!
function add(a, b) {
// XOR to get the sum of the bits
var sum = a ^ b;
// "Carry" bits are common to both numbers
var carry = (a & b) << 1;
if (sum & carry) {
// Rinse and repeat until there are no leftover bits
@wildlyinaccurate
wildlyinaccurate / workflows.md
Last active November 22, 2023 07:06
Hotfix workflows

Hotfix workflows

"Traditional" gitflow workflow

  1. Create hotfix-branch from release
  2. Commit to hotfix-branch
  3. Merge hotfix-branch into both release and develop

Pros

@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 / 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