Skip to content

Instantly share code, notes, and snippets.

👓
I may be slow to respond.

Mikael Brassman spoike

👓
I may be slow to respond.
Block or report user

Report or block spoike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:bb99d3c74154c2cf3e7064acb015b6f6
### Keybase proof
I hereby claim:
* I am spoike on github.
* I am spoike (https://keybase.io/spoike) on keybase.
* I have a public key ASBid-dWl9jmwlyW9ZQYKyIQxCk4s88XiEd4nsrqno_Gsgo
To claim this, I am signing this object:
@spoike
spoike / git-smart-checkout.sh
Created Dec 7, 2016
Git Checkout that remembers previous branch and lets you quickly switch between previous and current branches.
View git-smart-checkout.sh
function gch() {
local currentBranch=$(git rev-parse --abbrev-ref HEAD)
local previousFile="$(git rev-parse --show-toplevel)/.git/PREVIOUS_HEAD"
if [ -n "$1" ]; then
echo "$currentBranch" >> $previousFile
git checkout "$@"
else
if [ ! -f "$previousFile" ]; then echo >&2 "ERROR: Missing PREVIOUS_HEAD. Please run gch with 1 argument first."
else
git checkout "$(cat $previousFile | tail --lines=1)"
@spoike
spoike / prompt-emoji-setup
Last active Oct 28, 2016 — forked from oshybystyi/random-emoji.zsh-theme
Random emoji theme for zpresto
View prompt-emoji-setup
#
# A minimal emoji theme.
#
# Authors:
# Mikael Brassman
#
# Features:
# - Displays a random emoji as prompt
#
# Usage:
@spoike
spoike / curry.js
Created Jul 22, 2016
Simple implementation of a curry for teaching purposes
View curry.js
/*
* curry(fn: Function) => Function
* Simple implementation of currying a function
* Drawbacks:
* - Cannot be reused as stored args is mutable
* - Cannot use placeholders
* - Will not check argument overflow
*/
function curry(fn) {
var arity = fn.length; // check the arity of the given function
@spoike
spoike / gitproxy-socat
Last active Jan 21, 2016 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
View gitproxy-socat
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@spoike
spoike / use-pkg-node-version.sh
Last active Sep 18, 2015
Use node version specified in package.json (engines.node). Uses jq and nvm. Prompts when version is missing if you want to install it.
View use-pkg-node-version.sh
#!/usr/bin/env bash
#
# Switches to node version with nvm to the one defined in package.json
# Dependencies: nvm, jq
# Usage: Alias this by sourcing with ".", e.g. alias nnn='~/bin/use-pkg-node-version.sh'
if [ ! -e package.json ]; then
echo "Missing package.json file"
return 1
fi
@spoike
spoike / hubot-cumberbatch.coffee
Created Mar 12, 2015
Cumberbatch name generator for hubot that does not require the tumblr blog or twitter feed
View hubot-cumberbatch.coffee
# Description:
# Benedict Cumberbatch Name Generator
# Names taken from http://benedictcumberbatchgenerator.tumblr.com/
#
# Commands:
# hubot cumberbatch (me) - generates a fairly Cumberbatchy name
_ = require "lodash"
firstnames = ["Bumblebee", "Bandersnatch", "Broccoli", "Rinkydink", "Bombadil", "Boilerdang", "Bandicoot", "Fragglerock", "Muffintop", "Congleton", "Blubberdick", "Buffalo", "Benadryl", "Butterfree", "Burberry", "Whippersnatch", "Buttermilk", "Beezlebub", "Budapest", "Boilerdang", "Blubberwhale", "Bumberstump", "Bulbasaur", "Cogglesnatch", "Liverswort", "Bodybuild", "Johnnycash", "Bendydick", "Burgerking", "Bonaparte", "Bunsenburner", "Billiardball", "Bukkake", "Baseballmitt", "Blubberbutt", "Baseballbat", "Rumblesack", "Barister", "Danglerack", "Rinkydink", "Bombadil", "Honkytonk", "Billyray", "Bumbleshack", "Snorkeldink", "Anglerfish", "Beetlejuice", "Bedlington", "Bandicoot", "Boobytrap", "Blenderdick", "Bentobox", "Anallube", "Pallettown", "Wimbledon", "Buttercup", "Blasphemy", "Syp
@spoike
spoike / hubot-magicball.coffee
Created Mar 9, 2015
Ask hubot anything and it will consult the magic 8-ball
View hubot-magicball.coffee
# Description:
# Hubot magic 8-ball
#
# Dependencies:
# magicball
#
# Configuration:
# None
#
# Commands:
@spoike
spoike / svg_paths_cheatsheet.md
Last active Mar 23, 2019
Cheatsheet for SVG paths
View svg_paths_cheatsheet.md

Cheatsheet for SVG Path Data

Straight line commands

+------------+-------------------+--------+
| *M* or *m* | moveto            | (x y)+ |
+------------+-------------------+--------+
| *Z* or *z* | close path        | (none) |
+------------+-------------------+--------+
@spoike
spoike / slack_post.js
Created Mar 2, 2015
Simple Slack Incoming Webhook script for hubot to post useful messages (in pretty format) on channels/rooms. Also works without having hubot invited on the channel.
View slack_post.js
/**
* # Post messages using Slack's Webhook
*
* Use this in combination with node-cron to Schedule messages.
* No need to have the hubot invited on the actual channel to post.
*
* ## Dependencies
*
* superagent
* lodash
You can’t perform that action at this time.