Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am edwinschaap on github.
  • I am edwin (https://keybase.io/edwin) on keybase.
  • I have a public key ASC7j69EDE0EkmYF-c_h1ozaC60rRL-QOqOl7Dh90ZN5bAo

To claim this, I am signing this object:

const fs = require('fs');
const https = require('https');
const options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
https.createServer(options, (req, res) => {
res.writeHead(200);
alert('boo')
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<div id="map" style="width:100%px;height:400px;" class="google_map full"></div>
<script type="text/javascript">
var latlng = new google.maps.LatLng(0, 0);
var myOptions = {
zoom: 16,
center: latlng,
scrollwheel: true,
scaleControl: false,
disableDefaultUI: false,
@edwinschaap
edwinschaap / index.html
Last active December 16, 2015 16:59
d3.js visual approach
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>d3.js - Top 10 used words</title>
<script type="text/javascript" src="http://mbostock.github.io/d3/d3.v2.js?2.9.5"></script>
<style type="text/css">
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
@edwinschaap
edwinschaap / SzovegType.php
Created December 11, 2012 11:07
example form class in Silex
<?php
namespace Insolis\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;
class SzovegType extends AbstractType
{
@edwinschaap
edwinschaap / genAccessToken.php
Created March 16, 2012 14:33
generate access token
<?php
protected function genAccessToken() {
return md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));
}
module namespace tweetmap = "tweetmap";
declare function tweetmap:fetch-tweets($keyword as xs:string) as node()* {
let $baseuri := "http://search.twitter.com/search.atom?geocode=52.1583,4.49306,200km&amp;rpp=100&amp;q="
let $uri := concat($baseuri, $keyword)
return doc($uri)//*:feed//*:entry
};
declare function tweetmap:get-geo($placename as xs:string) as xs:string {
@edwinschaap
edwinschaap / skeleton.xq
Created March 11, 2011 09:49
twitter skeleton excerise
declare function fetch-tweets($keyword as xs:string) as node()* {
let $uri := "http://search.twitter.com/search.atom?geocode=52.1583,4.49306,200km&amp;rpp=100&amp;q=XXX"
return (: TODO replace XXX by keyword, fetch real entrys with doc() from uri :)
<entry><title>oops, I did it again</title><uri>http://twitter.com/britneyspears</uri><location>Hollywood</location></entry>
};
declare function get-geo($placename as xs:string) as xs:string {
let $uri := (:replace XXX by placename :)
"http://where.yahooapis.com/v1/places.q(&quot;XXX&quot;);count=1?format=xml&amp;appid=oWI.U034EMJO6CnsA4vFEvJ5oYEKsoD0qLIRfcoEKOLLTqv9bh6jBHZn9GhdRA--",
$centroid :=
@edwinschaap
edwinschaap / vps-clean-debian-ubuntu.sh
Created February 16, 2011 20:02
This scripts cleans up some mess from the default Ubuntu 10.10 (32bits)installation done by prefiber. Can be used on debian (not tested).
#!/bin/bash
function print_info {
echo -n -e '\e[1;36m'
echo -n $1
echo -e '\e[0m'
}
function print_warn {