Skip to content

Instantly share code, notes, and snippets.

View kvanbere's full-sized avatar
:octocat:
We write and test real time control software. @cuedo

Kyle Van Berendonck kvanbere

:octocat:
We write and test real time control software. @cuedo
View GitHub Profile
@kvanbere
kvanbere / .c
Last active December 15, 2017 10:10
#include <stdio.h>
typedef struct {
int foo;
int bar;
int qux;
} important_t;
void safelyPrintImportant(important_t imp[static 1]) {
printf("%d %d %d\n", imp->foo, imp->bar, imp->qux);
}
@kvanbere
kvanbere / .c
Created December 15, 2017 09:28
float round_float_to_4(float inputval[static 4]);
@kvanbere
kvanbere / .c
Created December 15, 2017 09:27
typedef struct {
int foo;
int bar;
int qux;
} important_t;
void safelyPrintImportant(important_t *imp) {
printf("%d %d %d\n", imp->foo, imp->bar, imp->qux);
}
@kvanbere
kvanbere / logger.js
Last active November 21, 2017 09:39
// ~ 120k log op/s
(function() {
var originalArrayValueOf = Array.prototype.valueOf;
var logs = {};
var index = 1;
function hasher(str) {
var target = Array.from(str);
target.length > 16 && (target = target.slice(0, 16)); // perf: avoid alloc
return target
.reduce(function(acc, i) {
@kvanbere
kvanbere / hasher.js
Last active November 17, 2017 08:52
function hasher(str) {
return Array
.from(str)
//.slice(0, 10)
.reduce(function(acc, i) {
return 0xffffffff & ((acc << 5) - acc) + i.charCodeAt(0); }, 0);
}
Array.prototype.valueOf = function() { console.log('bar', this); return this; }
(function() {
var oldValueOf = Array.prototype.valueOf;
Array.prototype.valueOf = function() {
if (oldValueOf.call(this) === -1) {
console.log('bar'); return -1;
} else {
return oldValueOf.call(this);
}
}
})()
@kvanbere
kvanbere / index.html
Last active November 12, 2017 10:51
Jumbotron menu
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="container">
<nav class="navigation">
<ul>
<li>
{-# OPTIONS_HADDOCK hide #-}
-- | Data
module Graphics.Gloss.Internals.Data.Blend
( BlendMode (..)
, blendModeFromComponents )
where
import qualified Graphics.Rendering.OpenGL.GL as GL
data BlendEquationMode
VERSION "HIPBNYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY/4/%%%/4/'%**4YYY///"
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_