Skip to content

Instantly share code, notes, and snippets.

@darul75
darul75 / helper_jpeglib.txt
Last active August 23, 2017 08:08
Max OS fatal error: 'jpeglib.h' file not found
Use Brew
> brew install libjpeg
find /usr | grep "libjpeg"
find /opt | grep "libjpeg"
Here what I have done

This demonstrates raster-based reverse geocoding using canvas and D3.js. Geocoding is based on the color of the pixel at a given projected position. Note that the canvas is only shown here for the sake of explanation and debugging - this would in fact probably work faster if the canvas was not attached to the document at all.

The biggest remaining issue here is precision, which depends on:

  • the size of the canvas, and
  • the projection used.

Determining the optimum size based on the accuracy of your data is left as an exercise for the reader. Edge cases will also fail here, generally returning null - one option might be to stroke neighborhoods in a color, and then return an "uncertain" value for any non-grayscale pixel.

<canvas width=220 height=150></canvas>
var util = require('util'),
http = require('http'),
events = require('events');
var Twitter = function(opts) {
this.username = opts.username;
this.password = opts.password;
this.track = opts.track;
this.data = '';
};
/*
* twitter-entities.js
* This function converts a tweet with "entity" metadata
* from plain text to linkified HTML.
*
* See the documentation here: http://dev.twitter.com/pages/tweet_entities
* Basically, add ?include_entities=true to your timeline call
*
* Copyright 2010, Wade Simmons
* Licensed under the MIT license
@darul75
darul75 / introrx.md
Created November 9, 2015 21:23 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
// Example Data
var CARS = [
{name: "Ferrari FF", horsepower: 660, dollar_value: 700000, in_stock: true},
{name: "Spyker C12 Zagato", horsepower: 650, dollar_value: 648000, in_stock: false},
{name: "Jaguar XKR-S", horsepower: 550, dollar_value: 132000, in_stock: false},
{name: "Audi R8", horsepower: 525, dollar_value: 114200, in_stock: false},
{name: "Aston Martin One-77", horsepower: 750, dollar_value: 1850000, in_stock: true},
{name: "Pagani Huayra", horsepower: 700, dollar_value: 1300000, in_stock: false}
];
@darul75
darul75 / gist:3a729200f89ab2b0452b
Last active August 29, 2015 14:15
exercise.tour.go
/*********************************************************/
// Exercise: Readers
// https://tour.golang.org/methods/11
package main
import "code.google.com/p/go-tour/reader"
type MyReader struct{}
var fs = require('fs');
Int64 = require('node-int64');
var varint = require('varint');
var lazy = require("lazy");
// http://braindrivendevelopment.com/2013/10/31/reading-a-file-in-node-js/
// http://lucene.apache.org/core/3_0_3/fileformats.pdf
var bufferSegmentGen = fs.readFileSync('./segments.gen');
var bufferSegments = fs.readFileSync('./segments_4o4');
/*
GITHUB MARKDOWN EXTRACTOR RULES
https://guides.github.com/features/mastering-markdown/
http://www.table-ascii.com/
http://www.loc.gov/marc/specifications/specchartables.html
http://www.utf8-chartable.de/unicode-utf8-table.pl