Skip to content

Instantly share code, notes, and snippets.

@VonHeikemen
VonHeikemen / completion.lua
Created November 16, 2021 17:20
Sublime-like autocompletion for neovim, using nvim-cmp and luasnip
--[[
Dependencies:
Completion:
https://github.com/hrsh7th/nvim-cmp
https://github.com/hrsh7th/cmp-buffer
https://github.com/hrsh7th/cmp-path
https://github.com/saadparwaiz1/cmp_luasnip
Snippets:
@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
#! /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 / 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
}
@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 / better-netrw.vim
Last active February 21, 2024 03:33
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 / 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 / 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 / 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-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);