Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am ianwremmel on github.
  • I am ianwremmel ( on keybase.
  • I have a public key whose fingerprint is 8786 E221 4560 8429 2781 B327 C9DA 1EE9 CCF2 1B28

To claim this, I am signing this object:

ianwremmel / collection.js
Last active Aug 29, 2015
Collection object for a dirty-checking world.
View collection.js
The MIT License (MIT)
Copyright (c) 2014 Ian W. Remmel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
ianwremmel / curl_only_supports_putting_files.php
Created Aug 31, 2012 PUTting PHP to Restful APIs (Like CouchDB) as JSON
View curl_only_supports_putting_files.php
foreach ($collection as $id => $data) {
$handle = fopen(FILENAME, 'w'€™);
$filesize = fwrite($handle, json_encode($data))
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, SERVER_URL . '/' . DATABASE . '/' . $id);
curl_setopt($ch, CURLOPT_PUT, TRUE);
$handle = fopen(FILENAME, 'r');
ianwremmel / queue.js
Created Sep 19, 2012
Some things in nodejs need to be done synchronously (or, at least, shouldn't be enqueued at the rate a foreach loop will do so). Once I wrote this function three or four times, I decided it was time to put it somewhere easily accessible.
View queue.js
* @file queue.js
* This is an asynchronous queue for nodejs. Initialize it with a callback to
* execute against each item in the queue and (optionally) a queue of items
* against which to operate. Then, execute emitter.emit('next') at the end of
* your callback to trigger each subsequent run. Queue.exec() returns the
* emitter you'll need. Once exec has been called, each time push() is called,
* the pushed item will be execuated against at the end of the queue (if the
* queue is empty, it will be executed imediately).
ianwremmel /
Created Jan 21, 2014
Setup all hosts on the `dev` TLD to point at ``.
brew install dnsmasq
# Configure automatic startup
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo mkdir /etc/resolver
echo "nameserver" | sudo tee -a /etc/resolver/dev
ianwremmel /
Last active Jun 29, 2017
Remove chai-as-promised

Apply this transform using jscodeshift to remove most chai-as-promised assertions.

Note: this codemod does not cover all of the assert.eventually cases, but they should be easy to add.

There's really no alternative to defining the function assert.isRejected. The following should approximate the functionallity from chai-as-promised.

  var chai = require('chai');

  chai.assert.isRejected = function isRejected(promise, expected) {
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`,
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 /
Last active Oct 28, 2017
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
# TODO create github issue template
# TODO create editorconfig
# TODO create eslintrc.yml
ianwremmel /
Last active Apr 23, 2018
# 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.