Skip to content

Instantly share code, notes, and snippets.

View jelmervdl's full-sized avatar

Jelmer jelmervdl

View GitHub Profile
@jelmervdl
jelmervdl / 1031.user.js
Created March 19, 2012 21:38
Stupid script with a typo
// ==UserScript==
// @name Stupid script with a typo
// @include http://*/*
// ==/UserScript==
function filterNode(node)
{
switch (node.nodeType)
{
case Node.ELEMENT_NODE:
@jelmervdl
jelmervdl / autopoke.user.js
Created April 9, 2012 14:15
Facebook autopoker
// ==UserScript== //
// @name Facebook autopoker
// @version 1.0
// @description Autopoke!
// @include http*://*.facebook.com/*
// @include https://www.facebook.com/
// @match http://*.facebook.com/*
// @match https://*.facebook.com/*
// @exclude http://*.facebook.com/login.php
@jelmervdl
jelmervdl / sql.php
Created April 26, 2012 09:26
Functional PHP classes
<?php
require_once __DIR__ . '/util.php';
class SQL_Table
{
protected $pdo;
protected $table_name;
@jelmervdl
jelmervdl / CMakeLists.txt
Created May 31, 2012 14:03
Dact issue 56
cmake_minimum_required(VERSION 2.6)
project(DACT)
set(CMAKE_CXX_FLAGS "-pthread")
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
ENDIF("${isSystemDir}" STREQUAL "-1")
@jelmervdl
jelmervdl / interpreter.php
Created June 12, 2012 08:47
Interpreter in PHP
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
class Scope
{
public $variables;
public $functions;
@jelmervdl
jelmervdl / export.js
Created July 8, 2012 21:43
Some snippets to store facebook chat history.
window.conversation = (function() {
var conversation = [];
Array.prototype.forEach.call(
document.querySelectorAll('#MessagingMessages .MessagingMessage'),
function(block) {
var sender = block.querySelector('.uiProfilePhoto').getAttribute('alt');
var timestamp = block.querySelector('abbr.timestamp').getAttribute('data-utime');
var messages = [];
@jelmervdl
jelmervdl / alpino_ds.dtd
Created September 27, 2012 14:58
Query validation against a DTD. Uses xqilla and libxml2.
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Alpino Dependency Structures DTD -->
<!--
$Id: alpino_ds.dtd,v 1.1 2005-11-25 14:43:27 geertk Exp $
We hebben het toplevel element
@jelmervdl
jelmervdl / compare-image.php
Created September 29, 2012 09:21
Compare image
<?php
function diff_images($a, $b)
{
$max_x = max(imagesx($a), imagesx($b));
$max_y = max(imagesy($a), imagesy($b));
$diff = imagecreatetruecolor($max_x, $max_y);
for ($x = 0; $x < $max_x; ++$x)
@jelmervdl
jelmervdl / derp-to-table.php
Created September 29, 2012 09:22
Derp to table
<?php
$input = trim('
1. Max Havelaar 12.7 14.8 13.3
2. Michiel [b]de[/b] Ruiter 14.4 11.8 13.3 14.4
3. Awesome Stuff and others 15.568 11.3 12.1
');
function parse_table($input)
{
@jelmervdl
jelmervdl / dont.cpp
Created October 12, 2012 12:35
Never ever do this.
#include <iostream>
#define voor for
#define ieder (
#define getal int
#define van =
#define tot ; i <=
#define doe ; ++i)
#define print std::cout <<
#define een 1