Skip to content

Instantly share code, notes, and snippets.

@VonHeikemen
VonHeikemen / Taskfile.js
Created May 19, 2020 15:37
minimal, no dependencies task runner for deno.
// Command line usage examples:
// 1: deno run --allow-run ./Taskfile.js start
// 2: deno run --allow-run ./Taskfile.js echo "what?"
// 3: deno run --allow-run ./Taskfile.js do-stuff one two three
run(Deno.args, {
start() {
exec.cmd('deno run ./src/index.js');
},
@VonHeikemen
VonHeikemen / example-transducers-v1.js
Created December 26, 2020 19:07
Contrived example of transducers in action
// Common Utilities
function compose(...fns) {
const apply = (arg, fn) => fn(arg);
return (initial) => fns.reduceRight(apply, initial);
}
function curry(arity, fn, ...rest) {
if(arity <= rest.length) {
return fn(...rest);
@VonHeikemen
VonHeikemen / example-transducers-v2.js
Created December 26, 2020 19:08
Contrived example of transducer in action
// Common Utilities
function compose(...fns) {
const apply = (arg, fn) => fn(arg);
return (initial) => fns.reduceRight(apply, initial);
}
function curry(arity, fn, ...rest) {
if(arity <= rest.length) {
return fn(...rest);
@VonHeikemen
VonHeikemen / example-transducers-v3.js
Last active December 28, 2020 18:28
Transducers (in javascript) in action.
// Getting some stats from https://dev.to/dashboard
// Inspired by this: https://dev.to/tylerlwsmith/get-your-dev-2020-year-in-review-scraping-data-using-the-console-3gen
function compose(...fns) {
const apply = (arg, fn) => fn(arg);
return (initial) => fns.reduceRight(apply, initial);
}
function to_transducer(reducer) {
if(typeof reducer['@@transducer/step'] == 'function') {
@VonHeikemen
VonHeikemen / rc.vim
Created January 4, 2021 03:02
simple vimrc
" ============================================================================ "
" === EDITING OPTIONS === "
" ============================================================================ "
" Don't include vi compatibility
set nocompatible
" Sensible backspace
set backspace=indent,eol,start
@VonHeikemen
VonHeikemen / better-netrw.vim
Last active November 26, 2024 12:28
Making a more intuitive netrw
" Open Netrw on the directory of the current file
nnoremap <leader>dd :Lexplore %:p:h<CR>
" Toggle the Netrw window
nnoremap <Leader>da :Lexplore<CR>
if &columns < 90
" If the screen is small, occupy half
let g:netrw_winsize = 50
else
@VonHeikemen
VonHeikemen / complete-rc.vim
Last active March 21, 2024 11:51
make vim into a nice editor with this completely pluginless rc
" ============================================================================ "
" === EDITING OPTIONS === "
" ============================================================================ "
" Don't include vi compatibility
set nocompatible
" Sensible backspace
set backspace=indent,eol,start
@VonHeikemen
VonHeikemen / esm.json
Last active February 10, 2021 13:22
Create a productive environment for small personal scripts. Only try this at home.
{
"cache": false,
"await": true
}
#! /usr/bin/env node
const os = require('os');
const getNetworkAddress = (interfaces) => {
for (const name of Object.keys(interfaces)) {
for (const interface of interfaces[name]) {
const {address, family, internal} = interface;
if (family === 'IPv4' && !internal) {
return address;
@VonHeikemen
VonHeikemen / simple.lua
Last active July 6, 2023 15:59
a simple neovim config you can use as init.lua
-- ========================================================================== --
-- == EDITOR SETTINGS == --
-- ========================================================================== --
local set = vim.opt
set.hidden = true
set.swapfile = false
set.backup = false
set.hlsearch = false