Skip to content

Instantly share code, notes, and snippets.

@liamstrilchuk
liamstrilchuk / flappy.html
Last active November 30, 2020 07:56
Flappy Bird in 373 bytes
<body onload="z=c.getContext`2d`;c.width=W=400,c.height=H=600,Y=E=200,Q=z.fillRect.bind(z),M=S=p=0;N=M=>z.fillStyle=M;c.onclick=_=>M=9;R=_=>{M=S=p=0,Y=E};setInterval(_=>{p=p||[W,Math.random()*W],N`red`,Q(0,0,W,H),Y-=M-=.5,X=p[0]-=8,N`black`,Q(X,0,V=50,Z=p[1]),Q(X,Z+E,V,H),(Y<Z||Y>Z+E)&&X<B&&R(),X<-V&&(p=0,S++),Y>H&&R(),Q(0,Y-9,B,B),z.fillText(S,9,B)},B=24)"><canvas id=c>
once upon a time
a long time ago
there was a little boy and girl
their names were Tim and Rose
Tim was six years old and Rose was five
Tim had black hair and blue eyes
Rose had red hair that hung down to her waist
tickle tickle tickle
and green eyes like the sea
@ddevault
ddevault / Makefile
Last active February 20, 2024 14:17
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@felipecrv
felipecrv / btree.js
Created April 1, 2018 13:32
In-memory B+ Tree implemented in Javascript with Flow type annotations
/* @flow */
const KEY_KIND_STRING = 1;
const KEY_KIND_NUMBER = 2;
const KEY_KIND_BOOL = 3;
const KEY_KIND_RECORD = 4;
type KeyKind = 1 | 2 | 3 | 4;
class KeyValue<K, V> {
key: ?K;

Core Coding Standard

Coding practices are a source of a lot of arguments among programmers. Coding standards, to some degree, help us to put certain questions to bed and resolve stylistic debates. No coding standard makes everyone happy. (And even their existence is sure to make some unhappy.) What follows are the standards we put together on the Core team, which have become the general coding standard for all programming teams on new code development. We’ve tried to balance the need for creating a common, recognizable and readable code base with not unduly burdening the programmer with minor code formatting concerns.

Table Of Contents

@xsot
xsot / instructions.md
Last active March 3, 2024 13:42
sed maze solver

Usage

sed -E -f solver.sed input where input is a file containing the maze.

For best results, resize your terminal to match the height of the maze. To disable animations, delete the lines containing p.

Maze format

The solver assumes the following:

  • The maze only contains the characters # \nSE
  • Every line has the same number of characters
  • There is only one start (S) and end (E)
@mbinna
mbinna / effective_modern_cmake.md
Last active July 30, 2024 03:54
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@kevinGodell
kevinGodell / mpeg-dash-ffmpeg-dashjs.md
Created September 20, 2017 22:53
Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.

Live streaming mpeg-dash video using ffmpeg and dash.js

Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.

Prerequisites

A linux server, such as Ubuntu

Apache web server installed, running, and reachable via its ip address
@mapio
mapio / graph.png
Last active July 23, 2020 22:22
Playing with my son Federico
graph.png