Skip to content

Instantly share code, notes, and snippets.

View bripkens's full-sized avatar
🙃

Ben Blackmore bripkens

🙃
View GitHub Profile
@bripkens
bripkens / .env
Last active April 5, 2023 12:35
OpenTelemetry locally
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
OTEL_SERVICE_NAME=my-service
OTEL_TRACES_EXPORTER=otlp
@bripkens
bripkens / 0-tailwind-colors.css
Last active November 9, 2022 16:08
Tailwind CSS Colors as CSS Variables / custom properties as of 2022-11-01
:root {
--black: #000;
--white: #fff;
--slate-50: #f8fafc;
--slate-100: #f1f5f9;
--slate-200: #e2e8f0;
--slate-300: #cbd5e1;
--slate-400: #94a3b8;
--slate-500: #64748b;
--slate-600: #475569;
@bripkens
bripkens / keybase.md
Last active October 17, 2022 11:58
keybase.md

Keybase proof

I hereby claim:

  • I am bripkens on github.
  • I am bripkens (https://keybase.io/bripkens) on keybase.
  • I have a public key ASCGdwOksdAn9dru7yap3-xQDLnpGll1pLrVRDDQEm5bOwo

To claim this, I am signing this object:

@bripkens
bripkens / event-loop-nashorn.js
Last active August 21, 2021 06:18
Java 8 Nashorn event loop "polyfill". javax.script.ScriptEngine#eval calls should immediately call window.main to enter the event loop and thus to avoid concurrency issues. The XMLHttpRequest simulation is not yet finished.
(function(context) {
'use strict';
var Timer = Java.type('java.util.Timer');
var Phaser = Java.type('java.util.concurrent.Phaser');
var TimeUnit = Java.type('java.util.concurrent.TimeUnit');
var AsyncHttpClient = Java.type('com.ning.http.client.AsyncHttpClient');
var timer = new Timer('jsEventLoop', false);
var phaser = new Phaser();
(function () {
'use strict';
var pageLoad = 'pl';
// aliasing globals for improved minifications
var win = window;
var doc = win.document;
var nav = navigator;
var encodeURIComponent = win.encodeURIComponent;
@bripkens
bripkens / gist:3769436
Created September 23, 2012 09:10
DOT file for finite state machine diagrams.
digraph finite_state_machine {
rankdir=LR;
node [shape = doublecircle]; 1;
node [shape = circle] 0;
node [shape = plaintext, label = ""]; start;
start -> 0 [ label = "start"];
0 -> 1 [ label = "[1-9]" ];
1 -> 1 [ label = "[0-9]" ];
@bripkens
bripkens / functional-table.html
Created December 19, 2012 19:26
Functional programming in JavaScript example with Lo-Dash
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.3/lodash.js"></script>
<table id="people">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th>Occupation</th>
</tr>
</thead>
@bripkens
bripkens / GameOfLife.scala
Last active November 15, 2015 16:29
Game of Life in Scala
package de.bripkens
object GameOfLife {
case class Point(x: Int, y: Int) {
lazy val neighbours: Seq[Point] = for (
xDistance <- -1 to 1;
yDistance <- -1 to 1;
eachPoint = Point(x + xDistance, y + yDistance);
if !(eachPoint.x == x && eachPoint.y == y)
) yield eachPoint
@bripkens
bripkens / simple-function-call.js
Created November 24, 2012 06:15
'JavaScript, State of the Art' article series: simple function example
// JSFiddle: http://jsfiddle.net/qQk7v/
var addMessage = function(message) {
var isWindowScope = window === this,
extendedMessage = message + ' (called with window context: ' + isWindowScope + ')',
textNode = document.createTextNode(extendedMessage);
document.body.appendChild(textNode);
};
addMessage('Welcome to: ' + location);​
// Renders the following in the body:
@bripkens
bripkens / eqeqeq.js
Created November 24, 2012 06:25
'JavaScript, State of the Art' article series: eqeqeq
> "42" === 42
false
> undefined === null
false
> 42 === 42.0
true