Skip to content

Instantly share code, notes, and snippets.

View ColinTimBarndt's full-sized avatar
:shipit:

Colin Barndt ColinTimBarndt

:shipit:
  • University of Saarland
  • Germany
  • 09:23 (UTC +02:00)
View GitHub Profile
@ColinTimBarndt
ColinTimBarndt / .zshrc
Created April 27, 2022 08:14
Oh My Posh Theme
eval "$(oh-my-posh init zsh --config ~/.poshthemes/colin.omp.json)"
enable_poshtooltips
@ColinTimBarndt
ColinTimBarndt / smallstring.rs
Created September 8, 2021 10:48
Diesel wrapper for Smallstring
mod smallstring {
use std::{
fmt,
ops::{Deref, DerefMut},
};
use diesel::{backend::Backend, types::FromSql};
use serde::{Deserialize, Serialize};
use smallstr::SmallString as ExtSmallString;
@ColinTimBarndt
ColinTimBarndt / search-generic.ts
Last active December 6, 2022 14:49
Binary Search in Typescript
function binarySearch<T>(arr: T[], entry: T, compare: (l: T, r: T) => number): number {
let mid: number = 0,
l: number = 0,
r: number = arr.length - 1,
e: T;
while (l <= r) {
mid = Math.floor((l + r) / 2);
if ((e = arr[mid]!) === entry)
return mid;
@ColinTimBarndt
ColinTimBarndt / rectangular-selection-clean.ts
Last active June 2, 2021 14:49
A very dirty CodeMirror 6 hack to manually update the selection when a key is pressed
/**
* Based on [@codemirror/rectangular-selection](https://github.com/codemirror/rectangular-selection)
* This is a clean implementation made possible by [this commit]
* [this commit]: https://github.com/codemirror/view/commit/6ec0d746ff3a33e3f73870fa7527779ec7af9904
* @license MIT
*/
import { Extension, EditorSelection, EditorState, SelectionRange, Facet, Compartment } from "@codemirror/state";
import { EditorView, MouseSelectionStyle, PluginValue, ViewPlugin, ViewUpdate } from "@codemirror/view";
import { countColumn, findColumn } from "@codemirror/text";