Skip to content

Instantly share code, notes, and snippets.

View ppKrauss's full-sized avatar
🌴
On vacation

Peter ppKrauss

🌴
On vacation
View GitHub Profile
@ppKrauss
ppKrauss / .block
Last active October 29, 2019 23:19
Brazilian States: Albers vs Mercator projections
license: mit
height: 600
@ppKrauss
ppKrauss / .block
Last active October 28, 2019 14:18 — forked from ruliana/.block
Brazilian States Topojson (Estados do Brasil)
license: mit
height: 600
@ppKrauss
ppKrauss / .block
Last active September 28, 2019 18:28
OLD TEST on sp-fill curves
license: mit
@ppKrauss
ppKrauss / .block
Last active September 26, 2019 00:45
compareCurves
license: mit
@ppKrauss
ppKrauss / index.html
Created July 5, 2019 19:52
Simple chart with C3 - in 5 minutes! // source https://jsbin.com/seriyih
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="showing C3js bug">
<meta charset="utf-8">
<title>Simple chart with C3 - in 5 minutes! </title>
<!-- Here are all the javascripts and css that you need, you can download them or linked them like here -->
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/5.9.7/d3.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/c3/0.7.1/c3.js"></script>
@ppKrauss
ppKrauss / index.html
Created July 5, 2019 18:59
Simple chart with C3 - in 5 minutes! // source https://jsbin.com/seriyih
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple chart with C3 - in 5 minutes! </title>
<!-- Here are all the javascripts and css that you need, you can download them or linked them like here -->
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/5.9.7/d3.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/c3/0.7.1/c3.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/c3/0.7.1/c3.css" rel="stylesheet" type="text/css">
@ppKrauss
ppKrauss / mod-jsonrpc.sql
Created December 30, 2017 14:41
JSON-RPC interface for PostgreSQL 9+ JSONb frameworks
/**
* JSON-RPC interface. Mini-lib, independent.
* Works fine with REST.
* See http://www.jsonrpc.org/specification (only error/code convention have little change)
* Free error string code:
* "$integer" = "$integer.0" = HTTP status code (only REST)
* "$integer.$integer" = status and internal error code (DEFAULT)
* use function rpc.errcode_merge() to merge default error reference and add internal part.
*/
@ppKrauss
ppKrauss / jsonb_object_summable.sql
Created August 16, 2018 07:34
Tool-kit for JSONb key-number objects
/**
* object_summable and "Merge sum" functions are for JSONb key-number objects,
* most usually key-integer for counting, like json-bags.
* They are "key counters", so, to merge two keys, the intValues must be added.
* Change the core of jsonb_merge_sum(jsonb,jsonb) to the correct datatype.
* The JSON "number" is equivalent to the SQL's ::numeric.
* Any invalid or empty JSONb object will be represented as SQL NULL.
*/
CREATE or replace FUNCTION jsonb_is_summable(jsonb) RETURNS boolean AS $f$
@ppKrauss
ppKrauss / gist:6099610
Last active December 20, 2015 08:19
RapiDOM, DOMDocument for "Rapid application development". A wrapper class for friendly interface to DOMDocument. Supports extended saveXML, loadStr, xsl_set, etc. methods and XSLT chaining.
<?php
/**
* DOMDocument for "Rapid application development".
* Do by overloading all DOMDocument methods, and add specialized methods.
* v0.1 2013-07-20 by ppkrauss, https://gist.github.com/ppKrauss/6099610
*
* Convention over configuration: UTF8, etc. by convention.
* Like fDOMDocument, BetterDOMDocument, FluentDOM, etc, to be
* a (more frindly interface) wrapper to DOMDocument methods.
* Like BetterDOMDocument and fDOMDocument, but NOT extends DOMDocument
<?php
/**
* Organiza dados em "estrutura BrasilProtestos2013-estimCidadeFontes"
* dispostos no anexo do artigo "Protestos no Brasil em 2013" da Wikipedia.
* NOTA: proxima versao no forno, classes e traducao XML.
* http://pt.wikipedia.org/wiki/Protestos_no_Brasil_em_2013
* http://pt.wikipedia.org/wiki/Anexo:Lista_de_cidades_participantes_dos_protestos_no_Brasil_em_2013
* http://pt.wikipedia.org/wiki/Predefini%C3%A7%C3%A3o:BrasilProtestos2013-estimCidadeFontes .
*/
header('Content-type: text/html; charset=UTF-8;' );// for txt and HTML source-code