Skip to content

Instantly share code, notes, and snippets.

View clarkwinkelmann's full-sized avatar

Clark Winkelmann clarkwinkelmann

View GitHub Profile
@clarkwinkelmann
clarkwinkelmann / background-for-tag.less
Created December 23, 2019 22:23
Some example custom CSS for Flarum
.TagTile-info[href="/t/general"] {
background-image: url(./custom/christmas-3015776_1920.jpg);
background-size: cover;
background-position: center center;
}
.DiscussionHero[style="background-color: rgb(136, 136, 136);"] {
background-image: url(./custom/christmas-3015776_1920.jpg);
background-size: cover;
background-position: center center;
body { background: red; }
@clarkwinkelmann
clarkwinkelmann / Pymio.aesl
Created June 9, 2018 14:17
Drive the Thymio with a keyboard
<!DOCTYPE aesl-source>
<network>
<!--list of global events-->
<event size="8" name="utimateLed"/>
<!--list of constants-->
@clarkwinkelmann
clarkwinkelmann / flarum.php
Last active May 4, 2018 15:54
Vanilla PHP helper to load discussions from Flarum API
<?php
/**
* Vanilla PHP helper to load discussions from Flarum API
* @author Clark Winkelmann
* @license MIT (c) Clark Winkelmann 2018
*/
class FlarumDiscussionStream
{
/**
@clarkwinkelmann
clarkwinkelmann / calendar.js
Last active August 27, 2018 19:47
Get total time for all events matching search request in Google Calendar webapp
(function () { let total = 0; for (let i=0, times=document.querySelectorAll('.vXnnM');i<times.length; i++) { let hours = times[i].innerText.split('à'); duration = (Date.parse('2017-01-0' + (parseInt(hours[0]) > parseInt(hours[1]) ? '2' : '1') + ' ' + hours[1]) - Date.parse('2017-01-01 ' + hours[0])); /*console.log(duration/60000);*/ total += duration; } let totalMinutes = total / 60000; return Math.floor(totalMinutes / 60) + ':' + (totalMinutes % 60); })();
class Morpion{constructor(){this.map=[null,null,null,null,null,null,null,null,null],this.joueur="x"}ajouterSymbole(a){if(!this.joueurActuel())throw"partie finie";if(a<0||a>8)throw"index case invalide";const b=Math.round(a);if(this.contenuCase(b))throw"case déjà utilisée";this.map[b]=this.joueur,this.joueur="x"===this.joueur?"o":"x"}joueurActuel(){return this.gagnant()?null:this.map.reduce(function(a,b){return a&&!!b},!0)?null:this.joueur}gagnant(){for(let a=0;a<9;a+=3){const b=this.map[a]===this.map[a+1]&&this.map[a+1]===this.map[a+2]&&this.map[a];if(b)return b}for(let a=0;a<3;a++){const b=this.map[a]===this.map[a+3]&&this.map[a+3]===this.map[a+6]&&this.map[a];if(b)return b}for(let a=-1;a<=1;a+=2){const b=this.map[4]===this.map[1+a]&&this.map[4]===this.map[7-a]&&this.map[4];if(b)return b}return null}contenuCase(a){return this.map[a]}}
@clarkwinkelmann
clarkwinkelmann / redirect.html
Last active September 2, 2016 21:15
Javascript redirect and Piwik tracking
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting to {{ page.title }}...</title>
{% comment %}
Performs a redirect to the given URL, and tracks the visit inside Piwik
http://stackoverflow.com/a/36846720/3133038 (GitHub Pages redirect layout)
http://stackoverflow.com/a/8692588/3133038 (Redirect with Google Analytics tracking)
{% endcomment %}
@clarkwinkelmann
clarkwinkelmann / KernelPurge.md
Created November 7, 2015 12:16
How to purge old linux images

Purge old Linux images

What's taking place on /boot ?

ls -A -S -l /boot/

Installed kernel packages:

dpkg -l linux-image-* | grep ^ii

@clarkwinkelmann
clarkwinkelmann / keybase.md
Created September 23, 2015 21:31
Keybase, here I am

Keybase proof

I hereby claim:

  • I am clarkwinkelmann on github.
  • I am clarkwinkelmann (https://keybase.io/clarkwinkelmann) on keybase.
  • I have a public key whose fingerprint is C02A 650D AD85 C824 92A0 FBF7 4FAB 7FF6 E9B7 2E9D

To claim this, I am signing this object:

@clarkwinkelmann
clarkwinkelmann / TetrisBot.c
Created September 7, 2015 16:52
The original TetrisBot for CEEBOT
extern void object::Tetris()
{
/*
######### ####### ######### ####### ### #######
######### ####### ######### ######## ### ########
### ### ### ### ### ### ####
### ##### ### ######## ### ######
### ### ### ####### ### ####
### ####### ### ### ### ### ########
### ####### ### ### ### ### #######