Skip to content

Instantly share code, notes, and snippets.

@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@schacon
schacon / git-related-files.rb
Last active June 24, 2024 07:31
git-related-files.sh
PryKeybind.register(:FRAMES, "\c_") do |pry_instance|
backt = Byebug.current_context.backtrace
result = Fzf(
delimiter: ":",
preview: 'bat --color=always --style=header, numbers -r ( range {3} $LINES) -H {3} ../{2}',
expect: 'ctrl-v'
) do
backt
.map(&:first)
.map(&:to_s)
@akihikodaki
akihikodaki / README.en.md
Last active July 16, 2024 20:40
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@v-kolesnikov
v-kolesnikov / Gemfile
Last active April 3, 2023 11:31
Asynchronous files downloader.
# frozen_string_literal: true
source "https://rubygems.org"
gem 'down'
gem 'dry-monads'
gem 'http'
@kez
kez / slugify.sql
Created May 13, 2019 14:50 — forked from ianks/slugify.sql
Generating Slugs in Postgres
CREATE EXTENSION IF NOT EXISTS "unaccent"
CREATE OR REPLACE FUNCTION slugify("value" TEXT)
RETURNS TEXT AS $$
-- removes accents (diacritic signs) from a given string --
WITH "unaccented" AS (
SELECT unaccent("value") AS "value"
),
-- lowercases the string
"lowercase" AS (
@tnymlr
tnymlr / youman.py
Last active February 3, 2020 00:02
youman
#!/usr/bin/env python3
import os
import shutil
import subprocess
import random
from argparse import ArgumentParser
from argparse import REMAINDER
from pathlib import Path
@Aerijo
Aerijo / tree_sitter_guide.md
Last active July 3, 2024 22:35
Guide to writing your first Tree-sitter grammar

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.