Skip to content

Instantly share code, notes, and snippets.

View sdondley's full-sized avatar

Steve Dondley sdondley

View GitHub Profile

The Straightforward Guide to Gitignore Patterns

Introduction

Git's primary job is to hep us track changes to the files in our repository. Towards that end, Git dutifully and repeatedly informs us about untracked files to help remind us to add them with with a git add command.

But there are many files we don't need or want to track and wish to exclude from our repository. We want Git to ignore these files so Git will stop

@sdondley
sdondley / gist:57972e3a507f7ec85d908f03fd2b6823
Last active August 2, 2023 19:18
Resarting/reloading neovim without quitting (sort of)
credit: chatgpt came up with this recipe for me
**The problem:** Modern package managers like lazy vim require you to restart neovim before any plugin changes can take effect. Doing `:wq, up arrow, enter` to reload neovim gets old quick when you are developing.
**Solution:**
First, write a bash script that automatically restarts vim if it exits with a specific exit code. Start all your vim sessions with this script:
```
#!/bin/bash
Blue Picasso, pink Picasso, cubist Picasso, society Picasso, surreal Picasso, ceramist Picasso, late Picasso. Picasso in his underwear, Picasso in a bow tie. Harlequin Picasso, bullfight Picasso, the poets’ Picasso, the GIs’ Picasso. Anti-fascist Picasso, communist Picasso, peace dove Picasso. Prankster Picasso, heartsick Picasso, lecherous Picasso.
Yes, Pablo Picasso was all over the place. He died 50 years ago this month at 91,and we’re still trying to clean up his mess.
Where America’s celebrated postwar artists — Jackson Pollock, Mark Rothko, Helen Frankenthaler, Roy Lichtenstein — had the good manners to settle on a tidy, signature style and stick to it, Picasso was the ultimate shapeshifter. As an artist — and as a man — he was so astonishingly manifold that we are left with little choice, it can seem, but to reduce him to a kind of sign. Picasso equals protean genius.
It’s no longer necessary that he connect in people’s minds with any actual art. It’s enough that he stands for that bigger thing: unf
@sdondley
sdondley / My Raku Recipes and Idioms
Created January 27, 2023 21:22
A collection of useful Raku snippets
# My Raku Recipes and Idioms
Here's a collection of Raku code snippets I use with explanations. Maybe you'll
also find them useful or If you find them useful you know better ways to accomplish things,
just let me know in the comments.
## Object construction
### Simpler construction
@sdondley
sdondley / gist:e804292fb707e6594d87c6d5417321a1
Created January 18, 2023 21:09
List of Raku distributions where the latest know version in REA has a file with a .t, .pm. or .pm6 fie extension
Last updted: Jan 18, 4:07 PM EST
"archive/6/6pm/6pm:ver<0.0.11>:auth<github:FCO>.tar.gz".IO
"archive/A/ABC/ABC:ver<0.6.13>:auth<zef:colomon>.tar.gz".IO
"archive/A/ADT/ADT:ver<0.5>:auth<github:timo>.tar.gz".IO
"archive/A/AI::Agent/AI::Agent:ver<0.2.10>:auth<cpan:KOBOLDWIZ>:api<1>.tar.gz".IO
"archive/A/AI::FANN/AI::FANN:ver<0.2.0>:auth<zef:jjatria>.tar.gz".IO
"archive/A/AI::NLP/AI::NLP:ver<0.1.5>:auth<cpan:KOBOLDWIZ>:api<1>.tar.gz".IO
"archive/A/ANTLR4/ANTLR4:ver<0.0.5>:auth<github:drforr>.tar.gz".IO
"archive/A/ANTLR4::Grammar/ANTLR4::Grammar:ver<0.6.2>:auth<cpan:JGOFF>.tar.gz".IO
@sdondley
sdondley / Resources.rakumod
Created June 24, 2022 03:00
trait_mod for automatically checking and modifying arguments to methods on the fly
multi sub trait_mod:<is>(Method $obj, Bool :$path-checked) {
$obj.wrap: -> $inv, $path, |c {
if $path.starts-with: $inv.root {
callsame;
} else {
callwith $inv, $inv.root ~ $path, |c;
}
}
}
use Injector;
use Data::Dump;
use lib '../Menu-Simple/lib';
use Menu::Simple;
unit class Distribution::Resources::Menu;
class ResourceMenu is export {
has CompUnit::Repository::Distribution $.dist is injected<dist>;
has Menu $.menu is rw;
has Hash $.menu-hash is rw;
@sdondley
sdondley / Menu.rakumod
Created June 21, 2022 11:34
Early snapshot of Distribution::Resources::Menu
use Injector;
use Menu::Simple;
unit class Distribution::Resources::Menu;
class ResourceMenu is export {
has CompUnit::Repository::Distribution $.dist is injected<dist>;
has Menu $.menu is rw;
method action(Str $path) {
say $path;
@sdondley
sdondley / 01-tests.rakutest
Created June 21, 2022 11:32
Test for Distribution::Resources::Menu
use v6.d;
use Test;
use Injector;
use Distribution::Resources::Menu;
use Distribution::Resources::Distribution;
BEGIN {
bind dist(), :name<dist>;
}
use v6.d;
unit module Simple;
class Menu { ... }
class Option {
has Str $.display-string is required;
has Int $.option-number;
has Menu $.submenu is rw;