Skip to content

Instantly share code, notes, and snippets.

CREATE OR REPLACE FUNCTION _st_distance(geography, geography, double precision, boolean)
RETURNS double precision AS
'$libdir/postgis-2.2', 'geography_distance_uncached'
LANGUAGE c IMMUTABLE STRICT
COST 100;
est=# CREATE TABLE test (id serial, condition_geo geography);
CREATE TABLE
test=# INSERT INTO test (condition_geo) VALUES (ST_Buffer(ST_GeogFromWKB(ST_MakePoint(20.0,30.0)),10.0));
INSERT 0 1
test=# SELECT id FROM test WHERE ST_Intersects("condition_geo", ST_Buffer(ST_GeogFromText('POINT(20.0 30.0)'), 20.0)) IS TRUE;
id
----
1
(1 row)
var Terraformer = require('../Terraformer/'),
GeoStore = require('../terraformer-geostore/node/terraformer-geostore.js').GeoStore,
RTree = require('../terraformer-geostore-rtree/').RTree,
LevelStore = require('../terraformer-geostore-leveldb/').LevelStore;
fs = require('fs');
var JSONStream = require('JSONStream');
var index = new RTree();
var store = new GeoStore({
for (var i = 0; i < 1000; i++) {
setTimeout(function () {
console.log(i);
}, 1000);
}
function(msg) {
if(/^hawthorne/.test(msg.message)) {
var match = msg.message.match(/^hawthorne\s+(.+)/);
var tap;
var taps = [ ];
json = http.get("http://api.legitimatesounding.com/api/hawthorne");
feed = JSON.parse(json);
// keep only the first 20
function(msg) {
if(/^hawthorne/.test(msg.message)) {
var match = msg.message.match(/^hawthorne\s+(.+)/);
var tap;
var taps = [ ];
json = http.get("http://api.legitimatesounding.com/api/hawthorne");
feed = JSON.parse(json);
// delete the first 20
function(msg) {
if(/^baileys/.test(msg.message)) {
var match = msg.message.match(/^baileys\s+(.+)/);
var tap;
var taps = [ ];
json = http.get("http://api.legitimatesounding.com/api/baileys");
feed = JSON.parse(json);
var tap_list = "Bailey's Taps: ";
Number.prototype.pad = function (length) {
var str = this.toString();
while (str.length < length) {
str = '0' + str;
}
return str;
};
{
"type": "MultiPolygon",
"coordinates":
[
[
[ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0] ]
],
[
[ [100.0, 0.0], [102.0, 0.0], [102.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
]
function build_user(username, email, password) {
var user = {};
user.name = username;
user.email = email;
user.salt = crypto.createHash('sha512').update(password).digest('hex');
user.date = new Date();
user.password_hash = hash.generate(password, { saltLength: 8, algorithm: 'sha512' });
return user;