Skip to content

Instantly share code, notes, and snippets.

View hotchpotch's full-sized avatar
🏠
Working from home

Yuichi Tateno (secon) hotchpotch

🏠
Working from home
View GitHub Profile
@krnlde
krnlde / promisify-http.js
Last active February 22, 2023 03:42
util.promisify.custom and http.get example
const http = require('http');
const {promisify} = require('util');
http.get[promisify.custom] = function getAsync(options) {
return new Promise((resolve, reject) => {
http.get(options, (response) => {
response.end = new Promise((resolve) => response.on('end', resolve));
resolve(response);
}).on('error', reject);
});
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: