Skip to content

Instantly share code, notes, and snippets.

View Nithanim's full-sized avatar

Nithanim

  • Somewhere with trains
  • Austria
View GitHub Profile
@ianmstew
ianmstew / plain-object-maps-typescript.md
Last active September 7, 2023 18:58
Plain objects as maps in TypeScript

So another 🤯 about TypeScript. We use plain objects as arbitrary maps all the time, but TypeScript deems that usage (correctly) too flexible.

const map = {};
map.foo = 'foo'; // Error: Property 'foo' does not exist on type '{}'.

Okay, then we need to type our object as a map:

@derhuerst
derhuerst / _.md
Last active October 7, 2024 11:57
List of HAFAS API Endpoints
@kui
kui / gist:2622504
Last active September 11, 2024 01:47
get the active window on X window system.
// -*- coding:utf-8-unix; mode:c; -*-
//
// get the active window on X window system
//
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <X11/Xlib.h> // `apt-get install libx11-dev`