Skip to content

Instantly share code, notes, and snippets.

View jssteinberg's full-sized avatar

Johan jssteinberg

View GitHub Profile
@jssteinberg
jssteinberg / space_confirms.vim
Created June 1, 2023 11:32
SPACE CONFIRMS - maps to cmdline that are confirmed with <space>
" SPACE CONFIRMS - maps to cmdline that are confirmed with <space>
" Setup:
" <space> is enter key in command mode if space_confirms
cno <expr> <space> exists("g:space_confirms") ? "<cr>" : " "
" space_confirms is unlet by autocmd so it's deactivated
augroup space_confirms | au!
au CmdlineLeave * if exists("g:space_confirms") | unlet g:space_confirms | en
augroup end
@jssteinberg
jssteinberg / space_search.vim
Last active June 1, 2023 11:38
space_search -- search mapped to `s`, then enter with `space`
" search with s in normal and visual mode
nnoremap s <cmd>let g:space_search=1<cr>/
xnoremap s <cmd>let g:space_search=1<cr>/
" backwards search with S in normal mode
nnoremap S <cmd>let g:space_search=1<cr>?
" in command mode, if space_search then <space> is <cr>
cnoremap <expr> <space> exists("g:space_search")
\ ? "<cr>" : " "
" autocmd to unlet variable so space_search is deactivated
augroup space_search | au!
@jssteinberg
jssteinberg / somedarkterm1.yml
Created July 14, 2022 07:58
Picture-perfect-first version of terminal theme somedarkterm1
# somedarkterm1
colors:
# Default colors
primary:
background: '0x15151e'
foreground: '0xc1c0d3'
# Normal colors
normal:
black: '0x2d2c3f'
<summary
className="button button--filter"
>
<svg className="icon--open" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.84082 1.25V14.75" stroke="#333333" strokeWidth="1" />
<path d="M14.5 8.09122L1 8" stroke="#333333" strokeWidth="1" />
</svg>
<svg className="icon--close" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.5 8.09122L1 8" stroke="#333333" strokeWidth="1" />
</svg>
@jssteinberg
jssteinberg / object-freeze-factory.js
Last active February 1, 2022 08:52
Seems more FP to freeze the object returned from a factory function, but what's the drawbacks (how slow is it)?
const newObj = ({param=`paramDefault`}) => Object.freeze({
param
});
@jssteinberg
jssteinberg / index.html
Last active December 2, 2022 10:42
My minimal HTML5 template
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Minimal HTML5 template</title>
<main>
<h1>Minimal HTML5 template</h1>
<p>This is valid HTML5.</p>
</main>
@jssteinberg
jssteinberg / .zshrc
Last active October 7, 2022 15:05
zshrc -- lightweight zsh (note: language, exports nvim; specific settings at bottom)
# LC/LANG: https://www.gnu.org/software/libc/manual/html_node/Locale-Categories.html
# System avail: `locale -a`
export LANG=en_US.UTF-8
export LC_COLLATE=no_NO.UTF-8
export LC_CTYPE=no_NO.UTF-8
# General
setopt correctall # autocorrect commands
setopt no_beep
<script context="module">
import { writable } from 'svelte/store';
/** @type {string} a11yTitle - A store to use for the title to announce on
* route change for screen readers. */
export const a11yTitle = writable('');
</script>
<script>
import { stores } from '@sapper/app';
import { tick } from 'svelte';
@jssteinberg
jssteinberg / GTM.svelte
Last active September 8, 2023 14:51
How to Implement Google Tag Manager in Svelte, in Functional Programming
<script>
import { onMount } from 'svelte';
/** @type {string} gtmId - GTM ID 'GTM-F00BARS'. */
export let gtmId = '';
/** @type {(Object[]|Object)} [gtmDataPoints=[]] - Array or single object of custom data points for dataLayer.
* @type {Object} [gtmDataPoints[]] - Custom data point Object.
* @type {string} [gtmDataPoints[][]] - Custom data point property. */
export let gtmDataPoints = [];
/** @type {number} [timeout] - The number of milliseconds to timeout intiating loading the GTM script from Google */

Keybase proof

I hereby claim:

  • I am jssteinberg on github.
  • I am johanland (https://keybase.io/johanland) on keybase.
  • I have a public key ASA-ZavfgHF6mF1dZAs5Bh0sc3OZPfa4ySkjGhGN9omxcQo

To claim this, I am signing this object: