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 | |
extension UIView { | |
// top bottom left and right | |
func anchorEdges(top: NSLayoutYAxisAnchor?, tConst: CGFloat = 0, | |
left: NSLayoutXAxisAnchor?, lConst: CGFloat = 0 , | |
right: NSLayoutXAxisAnchor?, rConst: CGFloat = 0 , | |
bottom: NSLayoutYAxisAnchor?, bConst: CGFloat = 0 | |
) -> (NSLayoutConstraint?, NSLayoutConstraint?, NSLayoutConstraint?, NSLayoutConstraint?) { |
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
extension UIColor { | |
convenience init(hex: Int, alpha: CGFloat = 1.0) { | |
let r = CGFloat((hex >> 16) & 0xff) / 255 | |
let g = CGFloat((hex >> 08) & 0xff) / 255 | |
let b = CGFloat((hex >> 00) & 0xff) / 255 | |
self.init(red: r, green: g, blue: b, alpha: alpha) | |
} } | |
// usage |
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
/* | |
@arr: array of 0s and 1s | |
@returns: an array of indexes | |
*/ | |
const findIndexes = arr => { | |
return arr.reduce((m, e, i) => { | |
e && m.push(i) | |
return m | |
}, []) | |
} |
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
module.exports = { | |
parser: "babel-eslint", | |
env: { | |
browser: true, | |
commonjs: true, | |
es6: true, | |
node: true, | |
jest: true, | |
}, |
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
## Install MongoDB on macOS Sierra | |
This procedure explains how to install [MongoDB](https://www.mongodb.org) using [Homebrew](http://brew.sh) on macOS Sierra 10.12. | |
Official MongoDB install documentation: [here](https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) | |
### Install Homebrew | |
* Installing Homebrew is effortless, open Terminal and enter : | |
`$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` |
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
const fetch = require("isomorphic-fetch") | |
const endpoint = `https://talaikis.com/api/quotes/random/` | |
function* createGetQuote(){ | |
const resp = yield fetch(endpoint) | |
const quote = yield resp.json() | |
return `${quote.quote}--${quote.author}` | |
} | |
const getQuote = createGetQuote() |
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
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" |
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 EventEmitter from "events" | |
import fs from "fs" | |
class WithTime extends EventEmitter { | |
execute(asyncFunc, ...args) { | |
console.time("execute") | |
asyncFund(...args, (err, data) => { | |
if (err) return this.emit("error", err) | |
this.emit("data", data) | |
console.timeEnd("execute") | |
this.emit("end") |
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
# cat << EOF > /dev/null | |
# https://github.com/gpakosz/.tmux | |
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, | |
# without any warranty. | |
# Copyright 2012— Gregory Pakosz (@gpakosz). | |
# /!\ do not edit this file | |
# instead, override settings in ~/.tmux.conf.local, see README.md | |
# -- general ------------------------------------------------------------------- |
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
# https://github.com/gpakosz/.tmux | |
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, | |
# without any warranty. | |
# Copyright 2012— Gregory Pakosz (@gpakosz). | |
# -- navigation ---------------------------------------------------------------- | |
# if you're running tmux within iTerm2 | |
# - and tmux is 1.9 or 1.9a | |
# - and iTerm2 is configured to let option key act as +Esc |