I hereby claim:
- I am ianwremmel on github.
- I am ianwremmel (https://keybase.io/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:
I hereby claim:
To claim this, I am signing this object:
// https://gist.github.com/ianwremmel/9c87948063741c12fece | |
/* | |
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 |
<?php | |
foreach ($collection as $id => $data) { | |
$handle = fopen(FILENAME, 'w'); | |
$filesize = fwrite($handle, json_encode($data)) | |
fclose($handle); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, SERVER_URL . '/' . DATABASE . '/' . $id); | |
curl_setopt($ch, CURLOPT_PUT, TRUE); | |
$handle = fopen(FILENAME, 'r'); |
#!/bin/bash | |
brew install dnsmasq | |
# Configure automatic startup | |
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons | |
sudo mkdir /etc/resolver | |
echo "nameserver 127.0.0.1" | sudo tee -a /etc/resolver/dev |
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) {
/** | |
* 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`, |
/** | |
* 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 |
#!/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 |
#!/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 |
#!/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" |