Skip to content

Instantly share code, notes, and snippets.

View netconstructor's full-sized avatar
💭
pushing pixels

Christian Hochfilzer netconstructor

💭
pushing pixels
View GitHub Profile
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@netconstructor
netconstructor / geoiq_leaflet.htm
Created December 13, 2011 04:11 — forked from timwaters/geoiq_leaflet.htm
geoiq geocommons and leaflet
<html><head><title>Geocommons and Leaflet JS</title>
<!-- Leaflet CSS -->
<link rel="stylesheet" href="CloudMade-Leaflet-404b097/dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="CloudMade-Leaflet-404b097/dist>/leaflet.ie.css" /><![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<!-- Leaflet JavaScript -->
<script type="text/javascript" src="CloudMade-Leaflet-404b097/dist/leaflet.js"></script>
@netconstructor
netconstructor / zoom_dependent_carto.md
Created December 15, 2011 06:21 — forked from tokumine/zoom_dependent_carto.md
zoom dependent Carto on CartoDB
@netconstructor
netconstructor / custom-post-type-flush-rewrite-rules.php
Created January 23, 2012 10:46 — forked from jeremyboggs/custom-post-type-flush-rewrite-rules.php
Pseudo-elegant way to flush rewrite rules after creating a custom post type.
<?php
/**
* Example for writing a WP plugin that adds a custom post type and flushes
* rewrite rules only once on initialization.
*/
/**
* On activation, we'll set an option called 'my_plugin_name_flush' to true,
* so our plugin knows, on initialization, to flush the rewrite rules.
*/
<div class="carousel">
<a href="#" class="prev">&nbsp</a>
<ul id="mycarousel" class="jcarousel-skin-carousel">
<?php global $ad_metabox; ?>
<?php query_posts('post_type=ad&showposts=-1') ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<li>
@netconstructor
netconstructor / location.php
Created March 17, 2012 11:07 — forked from thisislawatts/location.php
Advanced Custom Field - Location (+Search)
<?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:
@netconstructor
netconstructor / location.php
Created March 17, 2012 11:07 — forked from thisislawatts/location.php
Advanced Custom Field - Location (+Search)
<?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:
@netconstructor
netconstructor / location.php
Created March 17, 2012 11:07 — forked from thisislawatts/location.php
Advanced Custom Field - Location (+Search)
<?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:
@netconstructor
netconstructor / density_grid.sql
Created March 19, 2012 16:28 — forked from andrewxhill/density_grid.sql
Create a density grid from geometries. For use in CartoDB
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,
@netconstructor
netconstructor / regform.php
Created March 23, 2012 16:20 — forked from mhawksey/regform.php
Embedding and customising a Google Form in WordPress example (with dynamic parallel session selection)
<?php
$formKey = "blahblahblah"; // ENTER YOUR OWN VALUE - you can find your formkey by going to your live form in the spreadsheet and copying the value from the url
$redirectUrl = "http://www.yoursite.com/thank-you/"; // ENTER YOUR OWN VALUE - the url you want to direct people to after they fill in the form
$dataUrl = "https://spreadsheets0.google.com/spreadsheet/pub?blahblahblah&single=true&gid=1&output=csv"; // ENTER YOUR OWN VALUE - for parallel sessions you need to publish the public sheet via the share settings. This url is not published in the live webpage source
// function to get external webpages/data
function getData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);