Skip to content

Instantly share code, notes, and snippets.

View mickvangelderen's full-sized avatar

Mick van Gelderen mickvangelderen

  • The Netherlands
  • 23:06 (UTC +02:00)
View GitHub Profile
@mickvangelderen
mickvangelderen / gist:7430721
Created November 12, 2013 13:22
Compiler Construction lab day 6 parameter fun
// succeeds
test reference to parameter with equally named field available [[
class A {
int i;
int j;
public int m(int [[i]]) {
j = 0;
[[i]] = 0;
return 0;
@mickvangelderen
mickvangelderen / Spoofax eclipse.ini
Created November 20, 2013 11:46
My Spoofax eclipse.ini. Includes vm argument to shut spoofax up about the error message that was apparently fixed in the nightly build.
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
function Future$fork(rej, res){
check$fork(this, rej, res);
let immediate = false;
let clear = function Future$fork$immediateClear() {
immediate = true
};
const _this = this;
function maybeClear() {
if (_this._b && clear) {
clear()
@mickvangelderen
mickvangelderen / beepo.html
Created August 31, 2016 15:13
Simple interval timer.
<html>
<head>
</head>
<body>
<h1>Beepo</h1>
<p>A simple interval timer.</p>
<form>
function Dog(name) {
this.name = name
}
Dog.prototype.bark = function bark() {
return dog_bark(this)
}
function dog_bark(dog) {
return `${dog.name}: Woof!`
@mickvangelderen
mickvangelderen / index.cpp
Last active March 17, 2017 21:58
Enumerations with fields in c++
#include <iostream>
#include <random>
#include <cstdint>
struct Result {
// Types
public:
struct Amoeba {};
struct Robot {
# http://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 72
#[derive(Clone,Copy,Debug)]
enum State {
A,
B,
Trap,
}
impl State {
fn is_accepting(self) -> bool {
use State::*;
@mickvangelderen
mickvangelderen / README.md
Last active May 4, 2017 09:59
useful emoji
// Consider the following calls:
// PrintAngle((Radians) 0.10, "radians");
// PrintAngle((Degrees) 30, "degrees");
// Obviously no conversion are required, but without the IAngularUnit
// interface, we would have to provide copies of this method for each
// Unit manually.
public static void PrintAngle<TAngularUnit>(TAngularUnit angle, string unit) where TAngularUnit : IAngularUnit {
switch (unit) {
case "radians": System.Console.WriteLine("{0:F2} rad", (float) angle.ToRadians); break;
case "degrees": System.Console.WriteLine("{0:F2} deg", (float) angle.ToDegrees); break;