This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config() | |
const getEnvWithPrefixes = (prefixes = ['REACT_APP_', 'FIREBASE_']) => { | |
return Object.keys(process.env).reduce((prev, curr) => { | |
if (prefixes.some(p => curr.startsWith(p))) { | |
return { | |
...prev, | |
[curr]: process.env[curr], | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PlaygroundSupport | |
let cellSize = CGSize(width: 100, height: 100) | |
class Cell: UICollectionViewCell { | |
var imageView: UIImageView? | |
var identifier: String? | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Color LS | |
colorflag="-G" | |
alias ls="command ls ${colorflag}" | |
alias l="ls -lF ${colorflag}" # all files, in long format | |
alias la="ls -laF ${colorflag}" # all files inc dotfiles, in long format | |
alias lsd='ls -lF ${colorflag} | grep "^d"' # only directories | |
alias lsa="command ls -la | lolcat" | |
# Quicker navigation | |
alias ..="cd .." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTMLElement { | |
let name: String | |
let text: String? | |
lazy var asHTML: () -> String = { | |
[unowned self] in // without this capture list, self is captured strongly in the closure | |
if let text = self.text { | |
return "<\(self.name)>\(text)</\(self.name)>" | |
} else { | |
return "<\(self.name) />" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# need to install fuse and sshfs first https://osxfuse.github.io | |
sshfs user@host: /mountpath -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import Immutable from 'immutable' | |
export const resolveKeyPaths = (source: Immutable.Collection, keypaths: Array<any>) => { | |
const isFunction = (obj: any) => { | |
return !!(obj && obj.constructor && obj.call && obj.apply); | |
}; | |
var resolvedKeyPaths = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BOOTING="Booting " | |
if [ $# -eq 0 ] | |
then | |
SIMULATOR=$(xcrun simctl list | grep Booted | cut -d$'\n' -f1 | cut -d "(" -f2 | cut -d ")" -f1) | |
if [ ! -z "$SIMULATOR" ]; then | |
SIMULATORNAME=$(xcrun instruments -s | grep $SIMULATOR | cut -d "[" -f1) | |
BOOTING="Rebooting $SIMULATORNAME" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID `xcrun instruments -s | grep "iPhone 6s Plus (9.3)" | grep -v "Apple Watch" | cut -d "[" -f2 | cut -d "]" -f1` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
palette="palette.png" | |
filters="fps=10,scale=320:-1:flags=lanczos" | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $1.gif | |
rm -f $palette |