Skip to content

Instantly share code, notes, and snippets.

View allenpc's full-sized avatar

Allen Chen allenpc

View GitHub Profile
@allenpc
allenpc / concurrent.py
Created August 7, 2014 17:57
Concurrent calls in Python
import eventlet
import time
from eventlet.green import urllib2
urls = [
"http://www.amazon.com/",
"http://www.google.com/",
"http://www.twitter.com/"
]
@allenpc
allenpc / removekits.js
Created July 9, 2014 15:14
Remove all kits from TypeKit
var kit = require('typekit');
var API_KEY = 'YOUR_API_KEY';
kit.list(API_KEY, function(err, data) {
if (err) return console.log(err);
var kits = data.kits;
for (var i = 0; i < kits.length; i++) {
kit.remove(API_KEY, kits[i].id, function(err, data) {
if (err) return console.log(err);
@allenpc
allenpc / UIColor+HexString.h
Last active August 29, 2015 14:00
Create a UIColor from a hex value. Supports Android-style #ARGB values. Courtesy of Micah Hainline (http://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string)
//
// UIColor+HexString.h
//
#import <Foundation/Foundation.h>
@interface UIColor (HexString)
+ (UIColor *)colorWithHexString:(NSString *)hexString;
@allenpc
allenpc / gist:5400348
Created April 16, 2013 22:52
Generate a unique server ID in Node.js
// From https://github.com/marcello3d/node-buffalo/blob/master/lib/objectid.js
var machineHash = crypto.createHash('md5').update(os.hostname()).digest('binary');