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;
(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 / 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
var source = Rx.Observable.create(function (observer) {
setTimeout(() => observer.onNext(42), 0);
setTimeout(() => {
observer.onNext(7);
observer.onNext(11);
observer.onCompleted();
}, 500);
// Note that this is optional, you do not have to return this if you require no cleanup
return Rx.Disposable.create(() => console.log('disposed'));
@bripkens
bripkens / article.md
Last active August 29, 2015 14:16
Cancelable asynchronous operations with Promises

Lets take a look at existing cancelable AngularJS APIs:

$timeout

$timeout can be canceled via $timeout.cancel(promise). To make this possible, a $$timeoutId (source) is registered on the promise. This value is read by the $timeout.cancel(promise) function to actually call clearTimeout(...).

Unfortunately, this is not a good example for cancelable asynchronous operations with Promises.

$timeout returns a promise on which the then(onFulfilled, onRejected) function can be called. This function returns a new promise which does not have a $$timeoutId property and therefore cannot be used to call $timeout.cancel(promise).

@bripkens
bripkens / config.clj
Created February 8, 2015 16:52
How can one mock this?
(ns config)
; to be populated on application start before `service` is required.
; how can this def be mocked?
(def settings {})
@bripkens
bripkens / homeAutomationBackend.conf
Last active August 29, 2015 14:14
Home automation raspberry PI setup
#!upstart
# put in /etc/init/homeAutomationBackend.conf
description "Home Automation Backend Server"
author "Ben Ripkens"
start on startup
stop on shutdown
respawn
script
@bripkens
bripkens / workshop-vorbereitungen
Created January 15, 2015 07:36
Ionic Workshop Vorbereitungen
1.) Aktuelle Version von Chrome installieren
Installer kann heruntergeladen werden unter:
https://www.google.com/intl/en/chrome/browser/
2.) Chrome Erweiterung “Batarang” aus dem Chrome Web Store installieren
Die Erweiterung kann über den Chrome Web Store installiert werden:
https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en
3.) Aktuelle Version von Node.js und NPM installieren
Installer kann heruntergeladen werden unter:
@bripkens
bripkens / route-definition.js
Last active August 29, 2015 14:10
A quick test how to use the Angular UI router without controllers. Would need to remove resolvers as well, no?
angular.module('scheduler.conferences', ['ui.router', 'expose-to-scope'])
.config(function($stateProvider) {
$stateProvider
.state('conferences', {
url: '/conferences',
directive: 'conferenceList',
resolve: {
conferences: function(ConferenceService) {