Skip to content

Instantly share code, notes, and snippets.

View alinnert's full-sized avatar

Andreas Linnert alinnert

View GitHub Profile
alinnert / CodeMirror.tsx
Last active June 28, 2021 05:49
CodeMirror 6 React Component
import { FC } from 'react'
import { useCodeMirror } from './useCodeMirror'
interface Props {
content: string
classNames?: string
onContentChange: (content: string) => void
export const CodeMirror: FC<Props> = ({
alinnert / levelizeTree.js
Last active June 30, 2021 09:31
A function that flattens a tree structure while preserving nesting information
const { map, flatMapDeep, add, flow } = require('lodash/fp')
const data = [
id: 1,
type: 'group',
name: 'Colors',
items: [
{ id: 2, type: 'item', name: 'Red' },
{ id: 3, type: 'item', name: 'Purple' },
alinnert / tcmd_menu_deutsch.mnu
Last active November 16, 2017 14:12
Ein alternatives Menü-File für den Total Commander. Ergebnis einer Aufräumaktion.
POPUP "&Total Commander"
MENUITEM "&Einstellungen...", cm_config
MENUITEM "B&uttonbar anpassen...", cm_ButtonConfig
MENUITEM "Buttonbar &2 (vertikal) anpassen...", 583
MENUITEM "Einstellungs&dateien bearbeiten...", 581
MENUITEM "P&osition speichern", cm_configSavepos
MENUITEM "Einstellungen &speichern", 580
POPUP "&Hilfe"
MENUITEM "&Hilfe anzeigen\tF1", cm_HelpIndex
alinnert / classFunctions.js
Last active November 16, 2017 14:16
ES5 compatible DOM helper functions
* Returns true, if the given element contains the given class. False otherwise.
* @param {Element} element
* @param {String} className
* @returns {boolean}
function hasClass(element, className) {return getClasses(element).indexOf(className) !== -1;}
* Gets all classes of the given element.
alinnert /
Last active November 16, 2017 14:14
Automatically inserts a TOC to HTML files generated from markdown


If inserted in a HTML document auto-generated from markdown a TOC sidebar gets generated automatically.

How to use it with MarkdownPad

MarkdownPad is a Markdown Editor for Windows.

  1. Use the included stylesheet in this Gist. Replace an old one or create a new one.
  • Tools → Options → Stylesheets → Add or Edit
alinnert /
Last active November 16, 2017 14:18
equalheight.js 1.1.1


This script sets the height of inline-block elements that are displayed in a single line.

It is based on the script from I added some bug fixes, nice formatting and a version number.