Skip to content

Instantly share code, notes, and snippets.

View aredridel's full-sized avatar
💭
See my social media for status.

Aria Stewart aredridel

💭
See my social media for status.
View GitHub Profile
@aredridel
aredridel / README.md
Last active May 27, 2021 21:15
How to use npm version lifecycle scripts to make sure that publishes make it back to git

The problem

you bump the version of your package and publish to npm; the new version rolls out to users. However, you never make a tag, or forget to push it to github, so there's no record outside of npm that this has happened.

A solution using npm version lifecycle scripts

Add a script like this to your package.json:

@aredridel
aredridel / promise-tap.js
Created September 3, 2015 17:30
Evil hack
var P = require('bluebird');
var tap = require('tap');
var pt = wrap(tap);
function wrap(orig) {
return Object.create(orig, {
test: {
value: function(name, options, cb) {
if (!cb) {
cb = options;
Serves 4.
2 tablespoons vegetable oil
2 cups coarsely chopped cabbage
1 cup chopped onions
2 cloves of garlic, minced
1/2 teaspoon ground red pepper
1/2 teaspoon curry powder
1/4 teaspoon dried thyme
1 can (14.4 oz) whole peeled tomato (with juice)
4-6 servings.
3.5 oz dried rice noodles, cooked; or use spaghetti
2 carrots, grated
1/2 medium napa cabbage, shredded finely (regular cabbage works too)
5 cloves of garlic, minced
1 tablespoon fresh ginger, grated
3 green onions, sliced
1/2 to 1 teaspoon sesame oil
1 to 2 tablespoons brown sugar
@aredridel
aredridel / index.js
Last active August 29, 2015 14:11
Refactoring to continuation-passing
var http = require('http');
var bl = require('bl');
function start(callback) {
option = {};
options.path = '/start';
var req = http.request(options, function (res) { res.pipe(bl(callback)) });
req.end();
}
var fs = require('fs');
var http = require('http');
var png = fs.readFileSync('x.png.txt', 'utf8');
http.createServer(function (req, res) {
res.setHeader('Content-Type', 'image/png');
res.end(new Buffer(png, 'base64'));
}).listen(8080);
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.DataStoreFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.androidpublisher.AndroidPublisher.Builder;
@aredridel
aredridel / Async Code Katas I.md
Created March 17, 2014 05:09
Asynchronous Code Katas for Javascript

Asynchronous Javascript Code Katas

Part 1: Simple values, sequential flow

Write a synchronous get function and set function. Get a value, set a value, get again.

function makeThing() {
	var val = 0;
	return {
@aredridel
aredridel / keybase.md
Last active August 29, 2015 13:57
keybase.md

Keybase proof

I hereby claim:

  • I am aredridel on github.
  • I am aredridel (https://keybase.io/aredridel) on keybase.
  • I have a public key whose fingerprint is 7181 12A2 A598 9A18 C5C6 733A 382C 45D1 EB10 1DAC

To claim this, I am signing this object:

@aredridel
aredridel / DataUrl.ometajs
Last active August 29, 2015 13:56
Parsing data URL with ometajs
ometa DataUrl {
scheme = "data:",
type = /[a-z-]+/,
charset = /[a-z-]+/,
mimeType = type "/" type ( ";charset=" charset )?,
charset =