Instantly share code, notes, and snippets.

open ~/.bash_profile
brew link node@8
brew link node
cat ~/.bash_profile
echo 'export PATH="/usr/local/opt/node@8/bin:$PATH"' >> ~/.bash_profile
ls /usr/local/opt/node\@8/bin/
vim ~/.bash_profile 

npm i github:rajsuvariya/autocompletetextview#development

View gist:fdeacf470d9f9378baaf1d19ef973c09
The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements file are invalid, not permitted, or do not match those specified in your provisioning profile. (0xE8008016).
View isPlainObjectAlt.js
export default function isPlainObject(obj) {
if (typeof obj !== 'object' || obj === null) return false
let proto = obj
while (Object.getPrototypeOf(proto) !== null) {
proto = Object.getPrototypeOf(proto)
return Object.getPrototypeOf(obj) === proto
View npm i from branch.txt
npm i github:Noitidart/react-native-dialogs#patch-4
View gist:eb7035d55db6134b063e57528191e31f
View _js-getResponseAsJsonOrText.js
// figure out if response is json or text
const { status, headers:{map:{'content-type':[contentType]}} } = res;
const isJson = contentType && contentType.includes('json');
let reply = yield call([res, res.text]);
if (isJson) {
try {
reply = JSON.parse(reply);
catch(ignore) { console.log('failed to turn to json, Content-Type said it was json, contentType:', contentType) }
View requiredParam.js
function requiredParam (param) {
const requiredParamError = new Error(
`Required parameter, "${param}" is missing.`
// preserve original stack trace
if (typeof Error.captureStackTrace === 'function') {
View RN spread undefined.js
const a = undefined;
const b = [ ...a, 9 ]; // does not work
// const b = { ...a, '9': 9}; // works