Skip to content

Instantly share code, notes, and snippets.

View stijnvanbael's full-sized avatar

Stijn Van Bael stijnvanbael

  • Enprove
  • Belgium
View GitHub Profile
@stijnvanbael
stijnvanbael / data-visualization.html
Last active December 21, 2015 12:28
Data visualization
<html>
<head>
<meta charset="UTF-8"/>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Month", "Carbon emissions"],
@stijnvanbael
stijnvanbael / LazyList.java
Created November 25, 2013 11:34
Java List implementation that lazily initializes its contents when any method is called.
import org.apache.commons.lang3.concurrent.ConcurrentException;
import org.apache.commons.lang3.concurrent.LazyInitializer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
public abstract class LazyList<E> implements List<E> {
private LazyInitializer<List<E>> initializer = new LazyInitializer<List<E>>() {
@stijnvanbael
stijnvanbael / designer.html
Created November 14, 2014 15:41
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@stijnvanbael
stijnvanbael / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@stijnvanbael
stijnvanbael / StringTemplate.java
Last active August 29, 2015 14:13
Simple String formatting and parsing template with named parameters
/*
Copyright (c) 2014 Stijn Van Bael
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
private static final String[] GENERIC_TLDS = new String[] {
// Taken from Version 2016042500, Last Updated Mon Apr 25 07:07:01 2016 UTC
"aaa", // aaa American Automobile Association, Inc.
"aarp", // aarp AARP
"abb", // abb ABB Ltd
"abbott", // abbott Abbott Laboratories, Inc.
"abbvie", // abbvie AbbVie Inc.
"abogado", // abogado Top Level Domain Holdings Limited
"abudhabi", // abudhabi Abu Dhabi Systems and Information Centre
"academy", // academy Half Oaks, LLC
@stijnvanbael
stijnvanbael / TransactionDemo.java
Last active March 30, 2017 18:51
Transaction demo
import org.mariadb.jdbc.MariaDbDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Scanner;
public class TransactionDemo {