Skip to content

Instantly share code, notes, and snippets.

.ghx-done {
opacity: .4;
transition: .3s;
}
.ghx-done:hover {
opacity: 1;
}
@janwirth
janwirth / git-to-svn.sh
Created August 21, 2017 14:50
Sync git to svn - commit history will NOT be kept. One way sync only.
#!/bin/sh
SVN_REPO=mydomain.com/svn-repo/trunk
GIT_REPO=SVN_REPO=mydomain.com/git-repo.git
# CLONE GIT
rm -rf git-downstream
git clone $GIT_REPO git-downstream --depth=1
# CLONE SVN
rm -rf svn-upstream
@janwirth
janwirth / containedLoad.js
Last active December 18, 2017 17:08
Contain global JS libraries
// Load the given libraries without polluting the global namespace.
const libDefs = [
['https://cdn.jsdelivr.net/npm/[email protected]/dist/handlebars.min.js', 'Handlebars'],
['https://cdn.jsdelivr.net/npm/[email protected]', 'L'],
['https://cdn.jsdelivr.net/npm/[email protected]/dist/lodash.js', '_'],
['https://cdn.jsdelivr.net/npm/[email protected]', 'jQuery'],
['https://rawgit.com/joaquingatica/713768/raw/126357dd46a0e6aef4a8441a77d1e8e3ae81c0ba/typeface.js', '_typeface_js']
]
const i = document.createElement('iframe')
@janwirth
janwirth / lodash.d.ts
Last active December 31, 2017 13:23 — forked from amir-arad/lodash.d.ts
Add last, reduce, mapKeys; extend flow
// https://gist.github.com/FranzSkuffka/d9c52982c265d44a1093f218664b6a5f
// https://raw.githubusercontent.com/donnut/typescript-ramda/master/ramda.d.ts
// https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/lodash/lodash.d.ts
declare namespace fp {
interface Dictionary<T> {
[index: string]: T;
}
@janwirth
janwirth / fuzzy-file-duplicate-finder
Created January 8, 2018 20:27
Find fuzzy duplicates in a list
import levenshtein from 'fast-levenshtein';
import { filter, join, isEmpty, sortBy, get, identity, flow, map, toLower } from 'lodash/fp'
// https://stackoverflow.com/questions/43241174/javascript-generating-all-combinations-of-elements-in-a-single-array-in-pairs
function getCombinations(array) {
var results = [];
// Since you only want pairs, there's no reason
// to iterate over the last element directly
for (var i = 0; i < array.length - 1; i++) {
@janwirth
janwirth / kak_extract_rule
Created April 26, 2018 18:58
Kakoune extract rule from parse tree syntax
Zf.lf<space>Hyo<esc>F<esc>PA<space><minus><gt><space><esc>zf[f.lf<space>Hyjpzf[mf.lf<space>HyjA<space><esc>pkhhz
@janwirth
janwirth / dsgvo.md
Last active May 24, 2018 09:52
DSGVO

Musterdatenschutzerklärung für Websitebetreiber nach den Vorgaben der DSGVO

Erläuterung zur Musterdatenschutzerklärung

Die folgende Musterdatenschutzerklärung ist als Grundgerüst für eine der EU-Datenschutzgrundverordnung (DSGVO) konforme Datenschutzerklärung für Websitebetreiber zu verstehen. Die Erklärung ist nicht abschließend und umfasst nicht alle erforderlichen Elemente. Zudem können in der

@janwirth
janwirth / stalk.js
Created July 23, 2018 13:34
Monitor a person's whatsapp online status. Use with whatsapp web.
const STATUS_SPAN_SELECTOR = '.O90ur'
function record(data)
{
var a = [];
// Parse the serialized data back into an aray of objects
a = JSON.parse(localStorage.getItem('session') || '[]');
// Push the new data (whether it be an object or anything else) onto the array
a.push(data);
// Alert the array value
console.log('hi')
type Focus<T, T2> = (obj: T) => T2
const setIn = <T, T2>(expr: Focus<T, T2>) => (obj: T) => {
// convert path to array of strings
const propAccess = /\.([A-Za-z](\.[A-Za-z])*)/
const path: string[] = expr.toString()
.match(propAccess)[1]
.split('.')
console.log('hi')
type Focus<T, T2> = (obj: T) => T2
const setIn = <T, T2>(expr: Focus<T, T2>) => (obj: T) => {
// convert path to array of strings
const propAccess = /\.([A-Za-z](\.[A-Za-z])*)/
const path: string[] = expr.toString()
.match(propAccess)[1]
.split('.')