This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH inp as ( SELECT ST_Centroid(ST_Collect(ST_envelope(the_geom_webmercator))) as centroid, | |
ST_ConvexHull(ST_Collect(ST_Envelope(the_geom_webmercator))) as hull | |
FROM table_name GROUP BY some_column) | |
SELECT ST_Buffer(centroid, | |
ST_Length( ST_LongestLine(centroid, hull))) as the_geom_webmercator | |
FROM inp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function inspect(obj, maxLevels, level) | |
{ | |
var str = '', type, msg; | |
// Start Input Validations | |
// Don't touch, we start iterating at level zero | |
if(level == null) level = 0; | |
// At least you want to show the first level | |
if(maxLevels == null) maxLevels = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
geocoder.py | |
Created by Thomas Cabrol on 2012-02-08. | |
""" | |
import codecs | |
import simplejson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Advanced Custom Fields - New field template | |
* | |
* Create your field's functionality below and use the function: | |
* register_field($class_name, $file_path) to include the field | |
* in the acf plugin. | |
* | |
* Documentation: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TYPE CDB_DensityGridPair AS ( | |
geom GEOMETRY, | |
val FLOAT | |
); | |
CREATE OR REPLACE FUNCTION CDB_DensityGrid(table_name TEXT, geom_name TEXT, dimension FLOAT) | |
RETURNS SETOF CDB_DensityGridPair AS $$ | |
DECLARE | |
BEGIN | |
RETURN QUERY | |
EXECUTE 'SELECT ST_Envelope(GEOMETRYFROMTEXT(''LINESTRING(''||(st_xmax(geom)+(seed/2))||'' ''||(st_ymax(geom)+(seed/2))||'', ''||(st_xmin(geom)-(seed/2))||'' ''||(st_ymin(geom)-(seed/2))||'')'',3857)) as geom, val FROM (SELECT '||dimension||' as seed, count(*)::float as val, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TYPE CDB_DensityGridPair AS ( | |
geom GEOMETRY, | |
val FLOAT | |
); | |
CREATE OR REPLACE FUNCTION CDB_DensityGrid(table_name TEXT, geom_name TEXT, dimension FLOAT) | |
RETURNS SETOF CDB_DensityGridPair AS $$ | |
DECLARE | |
BEGIN | |
RETURN QUERY | |
EXECUTE 'SELECT ST_Envelope(GEOMETRYFROMTEXT(''LINESTRING(''||(st_xmax(geom)+(seed/2))||'' ''||(st_ymax(geom)+(seed/2))||'', ''||(st_xmin(geom)-(seed/2))||'' ''||(st_ymin(geom)-(seed/2))||'')'',3857)) as geom, val FROM (SELECT '||dimension||' as seed, count(*)::float as val, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, clear out any old mapnik or node.js installs that might conflict | |
sudo apt-get purge libmapnik libmapnik-dev mapnik-utils nodejs | |
# Also clear out any old ppa's that might conflict | |
sudo rm /etc/apt/sources.list.d/*mapnik* | |
sudo rm /etc/apt/sources.list.d/*developmentseed* | |
sudo rm /etc/apt/sources.list.d/*chris-lea* | |
# add new ppa's | |
echo 'yes' | sudo apt-add-repository ppa:chris-lea/node.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
include extra/proxy.conf; | |
include mime.types; | |
listen 80; | |
server_name blog.DOMAIN.NAME; | |
access_log logs/LOGFILE-access.log; | |
###error_log logs/LOGFILE-error.log debug; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pxi: pixels in image scale | |
// pxc: pixels in crop scale | |
// Helper function to create an element with optional attributes | |
// Doesn't jQuery already have this? | |
Monkeyman_FixedImageCroppper_createElement = function(tagName, attr) | |
{ | |
if (!attr) { | |
attr = {}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Safe Search and Replace on Database with Serialized Data v2.0.1 | |
* | |
* This script is to solve the problem of doing database search and replace when | |
* developers have only gone and used the non-relational concept of serializing | |
* PHP arrays into single database columns. It will search for all matching | |
* data on the database and change it, even if it's within a serialized PHP | |
* array. |