Skip to content

Instantly share code, notes, and snippets.

@nikolovlazar
nikolovlazar / keybindings.json
Last active May 4, 2024 16:14
VSCode key bindings to navigate like Neovim
[
// Navigation
{
"key": "ctrl-h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl-l",
"command": "workbench.action.navigateRight"
},
@nikolovlazar
nikolovlazar / slugify.js
Created January 13, 2024 18:42
An Obsidian QuickAdd script that renames the file/parent folder to its slugified version
// https://byby.dev/js-slugify-string
const slugify = function (str) {
return String(str)
.normalize("NFKD") // split accented characters into their base characters and diacritical marks
.replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
.trim() // trim leading or trailing whitespace
.toLowerCase() // convert to lowercase
.replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters
.replace(/\s+/g, "-") // replace spaces with hyphens
.replace(/-+/g, "-"); // remove consecutive hyphens
// Name: tmux sesh
// Description: Atach to a tmux session
// Author: Lazar Nikolov
// Twitter: @NikolovLazar
import '@johnlindquist/kit';
const sessionsCmd = await $`tmux list-sessions`;
let sessions = sessionsCmd.stdout
// Name: tmux sesh
// Description: Opens a tmux session
import '@johnlindquist/kit';
const sessionsCmd = await $`tmux list-sessions`;
let sessions = sessionsCmd.stdout;
sessions = sessions
.split('\n')
// Name: tmux sesh
// Description: Opens a tmux session
import '@johnlindquist/kit';
const sessionsCmd = await $`tmux list-sessions`;
let sessions = sessionsCmd.stdout;
sessions = sessions
.split('\n')
@nikolovlazar
nikolovlazar / dotfiles-install.sh
Last active June 16, 2023 01:14
Dotfiles installation script
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
git clone --bare https://github.com/nikolovlazar/dotfiles.git $HOME/.dotfiles
function dotfiles {
/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .config-backup
@nikolovlazar
nikolovlazar / popover-anatomy-illustration.tsx
Created December 30, 2022 12:15
The Popover Anatomy illustration
<AspectRatio ratio={16 / 9}>
<svg
width='100%'
height='100%'
viewBox='0 0 298 216'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<rect width='298' height='216' fill='white' />
<path
@nikolovlazar
nikolovlazar / Modal.kt
Created November 21, 2022 12:24
An example Modal UI built with Jetpack Compose.
@Composable
fun Modal() {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(40.dp),
) {
Icon(
Icons.Filled.Email,
"icon",
tint = Color(52, 120, 246), // similar to the iOS one
@nikolovlazar
nikolovlazar / Modal.swift
Created November 21, 2022 12:21
An example Modal UI built with SwiftUI.
//: An example Modal UI built with SwiftUI
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State private var emailAddress = ""
var body: some View {
VStack(spacing: 16) {
Image(systemName: "envelope.fill")
<AspectRatio ratio={16 / 9}>
<svg
width='100%'
height='100%'
viewBox='0 0 384 216'
fill='none'
xmlns='http://www.w3.org/2000/svg'
>
<rect width='384' height='216' fill='white' />
<rect x='140' y='92' width='87' height='32' rx='6' fill='#319795' />