Skip to content

Instantly share code, notes, and snippets.

🎸
rocking out

Jake Lazaroff jakelazaroff

🎸
rocking out
Block or report user

Report or block jakelazaroff

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 compose.ts
type Fn<A, B> = (a: A) => B;
function compose<A, B>(f1: Fn<A, B>): Fn<A, B>;
function compose<A, B, C>(f1: Fn<B, C>, fn2: Fn<A, B>): Fn<A, C>;
function compose<A, B, C, D>(
fn1: Fn<C, D>,
f2: Fn<B, C>,
fn3: Fn<A, B>
): Fn<A, D>;
function compose<A, B, C, D, E>(
View .slate
alias hyper ctrl;alt;cmd
# maximize
bind m:${hyper} move screenOriginX;screenOriginY screenSizeX;screenSizeY
# center
bind c:${hyper} move screenSizeX/6;screenSizeY/6 2*screenSizeX/3;2*screenSizeY/3
# edges
alias halfSizeX screenSizeX/2
View .tmux.conf
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# turn on mouse scrollback
setw -g mouse on
# index windows and panes at 1
set -g base-index 1
@jakelazaroff
jakelazaroff / SKImage.swift
Last active Jan 9, 2018
A simple class that draws a PaintCode StyleKit "Image Method" image centered inside a UIView
View SKImage.swift
// SKImage
// A simple class that draws a PaintCode StyleKit "Image Method" image centered inside a UIView
// - installation: add to project and replace STYLEKIT_NAME comment with name of StyleKit class
// - instantiation: SKImage(image: "NameOfImage")
// - instantiation (with custom size): SKImage(image: "NameOfImage", size: CGRectMake(0, 0, 16, 16))
import UIKit
class SKImage: UIView {
@jakelazaroff
jakelazaroff / path.js
Last active Aug 29, 2015
Returns the value of a nested property if it exists, or undefined if it doesn't.
View path.js
function nested(entity, path) {
path.split('.').some(function (property) {
entity = entity[property];
return typeof entity === 'undefined';
});
return entity;
};
@jakelazaroff
jakelazaroff / grid.scss
Last active Jan 3, 2016
small SASS grid.
View grid.scss
$column-width: 60px;
$gutter-width: 20px;
$line-height: 20px;
@function columns ($columns: 1) {
@return $columns * ($column-width + $gutter-width) - $gutter-width;
}
@function rows ($lines: 1) {
@return $line-height * $lines;
@jakelazaroff
jakelazaroff / .tmux.conf
Created Jan 2, 2014
Some screen key bindings for tmux.
View .tmux.conf
# set prefix to ctrl+a
unbind C-b
set -g prefix C-a
bind a send-prefix
# use space to cycle between windows
bind-key C-a last-window
bind-key Space next-window
bind-key C-Space previous-window
View propertyExists
function propertyExists (target, path) {
if (typeof path === 'string')
path = path.split('.');
try {
return path.length ? path[0] in target && propertyExists(target[path.shift()], path) : true;
} catch (e) {
return false;
}
}
@jakelazaroff
jakelazaroff / .screenrc
Created Nov 6, 2013
Nice simple .screenrc file
View .screenrc
startup_message off
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= %c"
vbell off
@jakelazaroff
jakelazaroff / cleanup.sh
Last active Dec 25, 2015
Removes all unused jpgs and pngs from a directory recursively.
View cleanup.sh
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for i in `find . -name "*.png" -o -name "*.jpg"`; do
file=`basename -s .jpg "$i" | xargs basename -s .png | xargs basename -s @2x`
result=`grep -r $file .`
if [ -z "$result" ]; then
git rm "$i"
fi
You can’t perform that action at this time.