Skip to content

Instantly share code, notes, and snippets.

View Webastronaut's full-sized avatar
🏠
Working from home

Philip Heinz Webastronaut

🏠
Working from home
View GitHub Profile
@Webastronaut
Webastronaut / cave.lp
Last active December 12, 2021 19:23
AoC2021 Day #12 Part #2
% undirected graph
edge(Y,X) :- edge(X,Y).
% hacky :(
% only needed to have dinstinct paths (otherwise there isn't any order leading to fewer models)
total(N*2) :- N=#count{X:edge(X,_)}.
% generate path for every edge
{ path(X,Y,Z) : Z=1..N } :- edge(X,Y), total(N).
visited("start",1).
@Webastronaut
Webastronaut / cave.lp
Last active December 12, 2021 19:19
AoC2021 Day #12 Part #1
% undirected graph
edge(Y,X) :- edge(X,Y).
% hacky :(
% only needed to have dinstinct paths (otherwise there isn't any order leading to fewer models)
total(N+1) :- N=#count{X:edge(X,_)}.
% generate path for every edge
{ path(X,Y,Z) : Z=1..N } :- edge(X,Y), total(N).
visited("start",1).
@Webastronaut
Webastronaut / module-pattern
Last active February 16, 2024 11:20
Module pattern
var myNamespace = myNamespace || {};
myNamespace.myFancyModule = (function() {
var public = {},
private = {};
private.concatString = function(str) {
return 'Hello ' + str;
};
@Webastronaut
Webastronaut / mixin-prefix.css
Last active January 2, 2016 05:39
Stop writing SASS mixins for every CSS attribute that needs a vendor prefix by using this simple Prefix-Mixin
/**
* Mixin for adding vendor prefixes to CSS attributes; useful for the following CSS attributes
*
* - border-radius
* - box-shadow
* - transition
* - transform
* - background-size
* - box-sizing
* - animate