Skip to content

Instantly share code, notes, and snippets.

View jlsa's full-sized avatar

Joel Hoekstra jlsa

View GitHub Profile
@jlsa
jlsa / gs.glsl
Created January 22, 2021 09:54 — forked from tim37021/gs.glsl
Geometry shader for switching between flat and smooth shading
#version 330
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out
uniform int enableSmooth=1;
in vec3 vNorm[3];
in vec3 vWorldPos[3];
in vec2 vTexCoord[3];
@jlsa
jlsa / fight.playground
Created September 2, 2020 09:28
Learning Swift 5. Fight between heroes and villains
// Hi!
// This started out as a small fight idea based on the video:
// https://youtu.be/Pd8IvykiW20 Swift 5 Tutorial 2020 by Derek Banas
// When having fun, I explore, so it became so much more.
// Trying my hands on all kinds of goodies that the Swift programming language had to offer.
// This is the result
import Cocoa
enum GameState {
@jlsa
jlsa / EasingFunctions.cs
Created March 6, 2018 15:47 — forked from cjddmut/EasingFunctions.cs
Easing Functions for Unity3D
using UnityEngine;
/*
* Created by C.J. Kimberlin (http://cjkimberlin.com)
*
* The MIT License (MIT)
*
* Copyright (c) 2015
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@jlsa
jlsa / Easing.cs
Created March 6, 2018 14:12 — forked from Fonserbc/Easing.cs
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
*/
public class Easing
{
public static float Linear (float k) {
<?php
/**
* A class that can be used for calculating statistics.
* Created to help me learn statistical formulas for my exam.
* @author Joël Hoekstra
* @version 2015-07-03
* @since 2015-07-01
*/
class Statistic
@jlsa
jlsa / nodes.cpp
Created October 20, 2017 15:31 — forked from emoon/nodes.cpp
// ImGui - standalone example application for Glfw + OpenGL 3, using programmable pipeline
#include <imgui.h>
#include "imgui_impl_glfw_gl3.h"
#include <stdio.h>
#include <GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <math.h>
#include <string.h>
#include <vector>
@jlsa
jlsa / Markov.py
Created September 18, 2017 12:09 — forked from benrules2/Markov.py
Markov Chain message generator
import random
import sys
def build_chain(text, chain = {}):
words = text.split(' ')
index = 1
for word in words[index:]:
key = words[index - 1]
if key in chain:
chain[key].append(word)
@jlsa
jlsa / gist:802856a762557a5124e417e25ff2845c
Created February 16, 2017 20:45 — forked from sirleech/gist:2660189
Python Read JSON from HTTP Request of URL
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost:81/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']
@jlsa
jlsa / node-ubuntu-upstart-service.md
Created June 26, 2016 21:48 — forked from willrstern/node-ubuntu-upstart-service.md
Run Node.js App as Ubuntu Upstart Service

###The Issue With Forever Forever is great for running node services, with a minor setback: the word "forever" doesn't apply to system reboots.

###The solution, run node apps as a system service logged in as root

vim /etc/init/node-app.conf

Contents for node-app.conf

@jlsa
jlsa / noise_listener.cpp
Created January 20, 2015 10:27
Observer Pattern example
/**
*
* @author Joel Hoekstra
* @version 1.0 (2015-01-20)
* This example shows the observer pattern.
*
* The Listener class is the Observer
* The Noise class is the Observable
*
* Unix Terminal - Compile is very easy!