Skip to content

Instantly share code, notes, and snippets.

@ianwremmel
ianwremmel / account-list.tsx
Created May 26, 2020 16:06
Declarative React Table
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 00:46
Runtime-overridable logger
import {logger} from './lib/logger';
class X {
get lgr() {
return logger;
}
method() {
this.lgr.info('called');
}
@ianwremmel
ianwremmel / tracker.js
Created January 25, 2019 21:39
Pivotal Tracker script for marking finished stories as delivered
#!/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 November 1, 2018 23:47
Can npx run this?
#!/usr/bin/env bash
echo "It Works!"
@ianwremmel
ianwremmel / cleanup.sh
Created November 1, 2018 23:46
Remove stale greenkeeper branches from the current repo
#!/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 June 4, 2018 01:48
backup your github repos
#!/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 February 9, 2022 11:55
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 October 28, 2017 19:46
Work in Progress for wiring up the bare-minimum github/ci flow
#!/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 August 7, 2017 18:01
codemod: add header banner
/**
* 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 August 3, 2017 20:24
codemod: remove wrapHandler
/**
* 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`,