Skip to content

Instantly share code, notes, and snippets.

View flatpickles's full-sized avatar

Matt Nichols flatpickles

View GitHub Profile
I am attesting that this GitHub handle flatpickles is linked to the Tezos account tz1U4KbdpQqKihxxMhboRNMdmuP9YMAYZrx4 for tzprofiles
sig:edsigtvY8DRNV4td5c7fLEj42su39iFQcCavoy1mRC1RJdS46FFyTXmtqngF4UivrwXqmijNfCsQhh9Gu3daKL2pp8yqoxdzqkz
@flatpickles
flatpickles / SKShapeNode Tiled Fill Texture
Last active July 15, 2018 20:42
SKShapeNode scales a fill texture by default, instead of repeating the pattern. This snippet extends SKShapeNode to support setting a tiled fill-texture.
import SpriteKit
extension SKShapeNode {
func setTiledFillTexture(imageName: String, tileSize: CGSize) {
let targetDimension = max(self.frame.size.width, self.frame.size.height)
let targetSize = CGSizeMake(targetDimension, targetDimension)
let targetRef = UIImage(named: imageName).CGImage
UIGraphicsBeginImageContext(targetSize)
let contextRef = UIGraphicsGetCurrentContext()
@flatpickles
flatpickles / Fast Branch Switcher
Last active January 3, 2016 09:39
Add this to your .bashrc for easier git branch management. Use `b` to view your most recently modified 15 branches, in order of recency, with short hash, name, and commit message. Use `bco` for the same, but to additionally enter a number and checkout the corresponding branch.
branch_count=15
alias b="git for-each-ref --sort=-committerdate refs/heads/ --count=$branch_count --format='%(objectname:short)\\%(refname:short)\\%(contents:subject)' | column -ts'\\'"
function bco {
# display recent branches
b | cat -n;
# read which the user wants to checkout
echo -n "checkout branch number: ";
read line;