Skip to content

Instantly share code, notes, and snippets.

@tabrindle
tabrindle / uninstall-zoom.sh
Created July 9, 2019 18:38
Uninstall zoom and prevent reinstall
rm -rf /Applications/zoom.us.app/
lsof -i :19421 | awk 'NR!=1{print $2}' | xargs kill -9
rm -rf ~/.zoomus
touch ~/.zoomus
@tabrindle
tabrindle / gist:59737b27925c128e36796a5dbdf26a49
Created January 16, 2019 16:49
preset-env last two years - browserlist query
"since 2017, not Baidu > 0, not QQAndroid > 0, not iOS > 0, not Samsung > 0, not Android > 0, not FirefoxAndroid > 0, not ChromeAndroid > 0"
or
"['chrome > 55', 'edge > 15', 'firefox > 52', 'safari > 10.1', 'opera > 42']" as of Nov 2018
Both queries amount to the same things at one point in time, but the top one updates
@tabrindle
tabrindle / example.sh
Created August 9, 2018 19:48
print insertions and deletions after git status
git() {
if [[ "$1" = "status" ]]; then
command git status;
command git --no-pager diff --shortstat HEAD
else
command git "$@"
fi
}
@tabrindle
tabrindle / resolve.js
Created April 15, 2018 22:55
Resolve promises in place - first library attempt
const pProps = require('p-props');
const sleep = (message) => new Promise(resolve => setTimeout(() => resolve(message), Math.floor(Math.random() * 2500)));
const get = message => sleep(message).then(res => res);
const data = {
Amit: get('Amit'),
vitae: get('vitae'),
Lorem: {
Tellus: get('Tellus'),
@tabrindle
tabrindle / sendPushNotification.js
Created November 7, 2017 15:20
Expo Notifications Demo - sendPushNotification
sendPushNotification(token = this.state.token, title = this.state.title, body = this.state.body) {
return fetch('https://exp.host/--/api/v2/push/send', {
body: JSON.stringify({
to: token,
title: title,
body: body,
data: { message: `${title} - ${body}` },
}),
headers: {
'Content-Type': 'application/json',
@tabrindle
tabrindle / registerForPushNotifications.js
Created November 7, 2017 15:20
Expo Notifications Demo - registerForPushNotifications
async registerForPushNotifications() {
const { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
return;
}
}
@tabrindle
tabrindle / App.js
Created October 16, 2017 14:58
Expo Push Notifications Demo
import React from 'react';
import {
StyleSheet,
TextInput,
TouchableOpacity,
Text,
KeyboardAvoidingView,
View,
} from 'react-native';
import { Permissions, Notifications } from 'expo';
@tabrindle
tabrindle / runIOS.js
Created July 27, 2017 14:54
add xcpretty optionally to ios build in react native
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
@tabrindle
tabrindle / npm-deps.md
Last active May 25, 2017 21:19
npm devDependencies vs dependencies
  • devDependencies are things like babel-cli and prettier or ava that you need to develop your app. If it is a command line tool or something that makes development possible, it should be here.

  • install using npm install <package> --dev or npm install <package> --save-dev to add to package.json in devDependencies

  • dependencies are packages that you are going to ship with the final product, and are required for your user to run your app, service or product.

  • install using npm install <package> or npm install <package> --save to add to package.json in dependencies

  • sometimes dependencies can also be devDependencies. Lodash is a common example of a package that is commonly used for development code (think unit tests, configuration scripts and similar) as well as front end.

- declaritive pipeline uses sh
- inject PATH overrides in jenkinsfile environment property
- can be per file, per stage
- useful for node version - nvm doesn't always work, pollutes log.
```
stage('Build') {
environment {
PATH='/usr/opt/someshit:$PATH'
}