Skip to content

Instantly share code, notes, and snippets.

View nicinabox's full-sized avatar

Nic Haynes nicinabox

View GitHub Profile
@nicinabox
nicinabox / env.sh
Created May 1, 2012 18:27
Pack Chrome extensions from the command line
# $ crx `pwd`
function crx() {
~/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --pack-extension=$@ --pack-extension-key=$@/key.pem
}
@nicinabox
nicinabox / lets split build guide.md
Last active January 28, 2023 04:10
This guide covers building a Let's Split v2.

This guide has moved

To improve collaboration this guide is now available on GitHub.

Continue reading

@nicinabox
nicinabox / flash.sh
Last active November 13, 2022 18:16
Find the Pro Micro serial port automatically and flash it
#!/bin/bash
# Usage
# ./flash.sh path/to/your.hex
TARGET=$1
ls /dev/tty* > /tmp/1
echo "Reset your Pro Micro now"
@nicinabox
nicinabox / device.js
Created September 14, 2012 16:11
Basic device properties for use when checking screen size or mobile.
/*
Author: Nic Aitch - @nicinabox
Version: 1.1
Description: Basic device properties for use when checking screen size or mobile.
License: MIT
*/
(function(window, document, undefined) {
var device = {};
@nicinabox
nicinabox / favicon.sh
Last active October 24, 2019 07:17
Convert favicon.png to an .ico with multiple sizes
convert favicon.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico
# confirm you can access the internet
if [[ ! $(curl -Is http://www.google.com/ | head -n 1) =~ "200 OK" ]]; then
echo "Your Internet seems broken. Press Ctrl-C to abort or enter to continue."
read
fi
# make 2 partitions on the disk.
parted -s /dev/sda mktable msdos
parted -s /dev/sda mkpart primary 0% 100m
parted -s /dev/sda mkpart primary 100m 100%

screen shot 2018-01-26 at 13 59 43

iTerm

I can't remember exactly why I started using this over the built in Terminal, but it's very customizable and feature rich.

zsh

Originally I switched to zsh to try something different from bash. Now I rely on features like hook functions and syntax highlighting.

function auto_workon() {
CURPWD=`pwd`
if [[ $CURPWD = "$ACTIVE_CURPWD"* ]] && [ -n "${ACTIVE_ENV+1}" ]; then
return
fi
if [[ -f .venv ]]; then
NEXT_ACTIVE_ENV=`cat .venv`
@nicinabox
nicinabox / http.js
Created May 8, 2017 15:06
React Native common parts
const toJSON = r => r.json()
const checkStatus = (r) => {
if (r.ok) return r
return toJSON(r)
.then((body) => {
let error = new Error(r.statusText)
error.body = body
error.response = r