Skip to content

Instantly share code, notes, and snippets.

@ianwremmel
ianwremmel / account-list.tsx
Created May 26, 2020
Declarative React Table
View account-list.tsx
import React from 'react';
import {Account} from '../../../mocks/account';
import {Table} from '../table/table';
export type AccountListProps = {
accounts: Account[];
};
export const AccountList = ({accounts}: AccountListProps) => (
@ianwremmel
ianwremmel / example.ts
Last active May 24, 2019
Runtime-overridable logger
View example.ts
import {logger} from './lib/logger';
class X {
get lgr() {
return logger;
}
method() {
this.lgr.info('called');
}
@ianwremmel
ianwremmel / tracker.js
Created Jan 25, 2019
Pivotal Tracker script for marking finished stories as delivered
View tracker.js
#!/usr/bin/env node
'use strict';
const {execSync} = require('child_process');
const querystring = require('querystring');
const {debug, format: f} = require('@ianwremmel/debug');
const fetch = require('cross-fetch');
@ianwremmel
ianwremmel / test.sh
Created Nov 1, 2018
Can npx run this?
View test.sh
#!/usr/bin/env bash
echo "It Works!"
@ianwremmel
ianwremmel / cleanup.sh
Created Nov 1, 2018
Remove stale greenkeeper branches from the current repo
View cleanup.sh
#!/usr/bin/env bash
set -euo pipefail
BRANCHES=$(git branch -r | grep origin | grep greenkeeper)
for BRANCH in $BRANCHES; do
echo "Deleting $BRANCH"
git push origin --delete "${BRANCH//origin\//}"
echo "Done"
@ianwremmel
ianwremmel / github.sh
Last active Jun 4, 2018
backup your github repos
View github.sh
#!/usr/bin/env bash
set -euo pipefail
NAMES=$(curl -n 'https://api.github.com/user/repos?affiliation=owner&per_page=100' | jq -r .[].name)
for NAME in $NAMES; do
echo $NAME
git clone "git@github.com:$GITHUB_USERNAME/$NAME.git"
done
@ianwremmel
ianwremmel / merge-dependabot-pr.sh
Last active Apr 23, 2018
merge-dependabot-pr.sh
View merge-dependabot-pr.sh
#!/bin/bash
# This script creates a consolidate Pull Request for all outstanding dependabot
# Pull Requests.
#
# Motivation: Sometimes, dependabot opens a large number of PRs that all need to
# be merged. Each time one merges, it causes the rest to be out of date, making
# it a slow, manual process of clicking upate, waiting for ci, then clicking
# merge for each subsequent PR.
#
@ianwremmel
ianwremmel / project-init.sh
Last active Oct 28, 2017
Work in Progress for wiring up the bare-minimum github/ci flow
View project-init.sh
#!/usr/bin/env bash
# TODO do not push package.json until circle ci is following the repo
# TODO add local template for package.json
# TODO every curl needs better success checking
# TODO non-interactive mode
# TODO create CONTRIBUTE.md
# TODO create github issue template
# TODO create editorconfig
# TODO create eslintrc.yml
@ianwremmel
ianwremmel / transform.js
Last active Aug 7, 2017
codemod: add header banner
View transform.js
/**
* Adds a copyright banner to all files, removing any copyright banner that may
* have already existed.
*
* Note: You'll need to run `eslint --fix` afterwards to remove the stray
* whitespace that this transform adds.
*/
module.exports = function transform({source}, {jscodeshift}) {
const j = jscodeshift;
// apply trim to remove any leading whitespace that may already exist
@ianwremmel
ianwremmel / transform.js
Created Aug 3, 2017
codemod: remove wrapHandler
View transform.js
/**
* turns e.g.
*
* ```
* const wrapHandler = require(`../lib/wrap-handler`);
* const {list, spawn} = require(`../util/package`);
*
* module.exports = {
* command: `exec cmd [args...]`,
* desc: `Run a command in each package directory`,