Skip to content

Instantly share code, notes, and snippets.

View stravid's full-sized avatar

David Strauß stravid

View GitHub Profile
@stravid
stravid / category_aware_next_generator.rb
Created November 15, 2012 14:22
Category aware next attribute for a Jekyll post
module Jekyll
class CategoryAwareNextGenerator < Generator
safe true
priority :high
def generate(site)
site.categories.each_pair do |category_name, posts|
posts.sort! { |a, b| b <=> a }
{
oldPkgs ? import (fetchGit {
url = https://github.com/NixOS/nixpkgs;
ref = "3b9b8726bdbb5405919c40920d9693c5eae246b5";
}) {},
newPkgs ? import (fetchGit {
url = https://github.com/NixOS/nixpkgs;
ref = "nixos-19.03";
}) {}
}:
@stravid
stravid / machine.js
Created October 30, 2020 07:12
Generated by XState Viz: https://xstate.js.org/viz
const onlineTestMachine = Machine({
id: 'Online-Test',
initial: 'daten_laden',
context: {
beispielaufgaben: [1, 2, 3],
testteile: [
[4, 5, 6, 7],
[8, 9],
[10, 11, 12],
],
@stravid
stravid / machine.js
Created June 4, 2020 12:33
Generated by XState Viz: https://xstate.js.org/viz
const Soll = Machine({
id: 'Soll Stand',
initial: 'AngeforderterPosten',
states: {
AngeforderterPosten: {
on: {
stellen: 'GestellterPosten',
abbrechen: 'AbgebrochenerPosten',
}
},
@stravid
stravid / machine.js
Last active May 26, 2020 11:40
Generated by XState Viz: https://xstate.js.org/viz
const Soll = Machine({
id: 'Soll Stand',
initial: 'Leer',
states: {
Leer: {
on: {
anfrageErhalten: 'Anfrage',
angebotAngefragt: 'AngefordertesAngebot'
},
},
@stravid
stravid / machine.js
Last active May 26, 2020 10:26
Generated by XState Viz: https://xstate.js.org/viz
const Ist = Machine({
id: 'Ist Stand',
initial: 'Leer',
states: {
Leer: {
on: {
anfrageErhalten: 'Anfrage',
angebotAngefragt: 'AngefordertesAngebot'
},
},
@stravid
stravid / child-machine.js
Last active March 23, 2020 16:28
Statechart Parent Child Activity Example
const { Machine } = XState;
export default Machine({
id: 'child',
initial: 'present',
context: {
name: undefined
},
states: {
present: {
@stravid
stravid / SketchSystems.spec
Last active February 9, 2019 08:54
Pre-Match*
Pre-Match*
start match -> Match
Match
Starting Order*
play -> Game
Game
Running?*
another dart can be thrown? -> During
no dart can be thrown? -> After
During
@stravid
stravid / example.js
Last active June 2, 2018 15:14
A simple way to track how far users are scrolling. Assumes you are using Mixpanel and jQuery. Copyright © 2013 David Strauß MIT License
new MixpanelScrollTracker({
attribute: 'section',
event: 'Scrolled to',
markers: [
{ position: 500, value: 'Services' },
{ position: 700, value: 'About Us' },
{ position: 900, value: 'Contact Form' }
]
});
class Web < Roda
def initialize(database_url:)
@database_url = database_url
end
route do |r|
r.root do
"Configured database URL: #{@database_url}"
end
end