Skip to content

Instantly share code, notes, and snippets.

Dawson Botsford dawsbot

Block or report user

Report or block dawsbot

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 keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@dawsbot
dawsbot / image-minifier.sh
Last active Jan 27, 2019
Lossless image compression for all images in current directory
View image-minifier.sh
#!/bin/bash
# Minify all jpg and png images in current directory recursively
command_exists () {
type "$1" &> /dev/null ;
}
if command_exists optipng ; then
optipng *.png
else
echo 'Error: optipng is not installed. If you are on a Mac, we recommend googling "homebrew Mac" and installing via brew' >&2
@dawsbot
dawsbot / add-eslint.sh
Last active Mar 24, 2017
Add uber eslint to a project (assumes you don't have a `.eslintrc` to begin)
View add-eslint.sh
#!/bin/bash
yarn add eslint eslint-config-uber-es2015
echo '{\n "extends": ["eslint-config-uber-es2015"]\n}' > .eslintrc
View RandomString.js
const tmpDir = path.join(os.tmpdir(), Math.random().toString().slice(8), basename);
@dawsbot
dawsbot / curl.js
Last active Mar 23, 2017
es6AF way to curl to tempfile
View curl.js
const url = 'https://google.com';
const pify = require('pify');
const fs = pify(require('fs'));
const fetch = require('node-fetch');
const tempfile = require('tempfile');
const curl = (package, version) => {
fetch(url)
.then(res => res.text())
@dawsbot
dawsbot / addOwners.sh
Created Dec 14, 2016
Give npm owner permissions to a team of people instantly
View addOwners.sh
#!/bin/bash
users=(npmusername1 npmusername2 npmusername3)
for user in "${users[@]}"
do
npm owner add "$user"
done
View facebook-button-v1.css
.facebook-button {
color: white;
background-color: rgb(66, 103, 178);
}
View facebook-button.css
.facebook-button {
color: white;
background-color: rgb(66, 103, 178);
border-color: rgb(66, 103, 178);
border-radius: 2px;
border-style: solid;
border-width: 1px;
padding: 0px 16px 0px 16px;
line-height: 22px;
}
@dawsbot
dawsbot / reactComponentLifecycle.txt
Last active Sep 28, 2016
React component lifecycle
View reactComponentLifecycle.txt
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
@dawsbot
dawsbot / 5to6-exports.js
Last active Jan 12, 2019
jscodeshift mod
View 5to6-exports.js
'use strict';
export default function transformer(file, api) {
const j = api.jscodeshift;
const {expression, statement, statements} = j.template;
const root = j(file.source);
return root
.find(j.Program, {
body: [
j.AssignmentExpression
You can’t perform that action at this time.