Skip to content

Instantly share code, notes, and snippets.

var shhh = "SECRETPASSWORD";
function hexToRgb(hex) {
// No RegEx in Espruino yet...
var R, G, B;
if (hex.length == 3) {
R = hex.substring(0, 1);
R = R + R;
G = hex.substring(1, 2);
G = G + G;
@stephenkeep
stephenkeep / README.md
Last active August 29, 2015 14:16 — forked from lobodin/README.md

#Generate cities data

  1. wget http://download.geonames.org/export/dump/cities15000.zip
  2. unzip cities15000.zip
  3. node geonames.js cities15000.txt

The result is json array of cities in the following format:

{

_id:

#define DATA(str) [(NSString*)(str) dataUsingEncoding:NSUTF8StringEncoding]
- (NSData *)generateFormData:(NSDictionary *)dictionary boundary:(NSString *)boundary {
NSMutableData *data = [[NSMutableData alloc] init];
id key;
NSEnumerator *enumerator = [dictionary keyEnumerator];
while (key = [enumerator nextObject]) {
id value = [dictionary valueForKey:key];
[data appendData:DATA(([NSString stringWithFormat:@"--%@\r\n", boundary]))];