This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```ansi | |
Resetting to normal color and style is done by inserting ``⟨esc⟩[0m``. | |
Basic colors, foreground and background (meh): | |
[0;30m 30 Black [0;40m 40 Black [0m | |
[0;31m 31 Red [0;41m 41 Red [0m | |
[0;32m 32 Green [0;42m 42 Green [0m | |
[0;33m 33 Yellow [0;43m 43 Yellow [0m | |
[0;34m 34 Blue [0;44m 44 Blue [0m | |
[0;35m 35 Magenta [0;45m 45 Magenta [0m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
# ID: misc79 unicode | |
for ^2**20 -> $u { | |
my $c = chr $u; | |
my $n = uniname $c; | |
printf "$c U-%X %s\n", $u, $n if $n ~~ /'SNOW'/; | |
} | |
# -------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ⦃▸ snipraku b rx14⦄ | |
snipraku.raku \ | |
/home/lucs/prj/t/raku/bin/snips.raku \ | |
/tmp/snips-raku \ | |
$* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env raku | |
=begin pod | |
=head1 NAME | |
snipraku - Extract and run Raku snippets. | |
=head1 SYNOPSIS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin pod | |
⌊raku --doc=Markdown ⟨this file⟩⌉ produces | |
improper Markdown for the beginning here; | |
Indented | |
Baz | |
Indented | |
Foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want a LEAVE block to run after a sub has completed, | |
but only if some condition is True. | |
# -------------------------------------------------------------------- | |
# Start from this. | |
sub foo1 { | |
⋯ | |
LEAVE {⋯} | |
⋯ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------------------- | |
#`( | |
I have 「A.rakumod」 which exports two multi variations of | |
subroutine 「orig」. I would like the user to be able to do for | |
example 「use A 'mine'」, so that they can invoke the exported subs | |
with some other arbitrary name instead. | |
) | |
# -------------------------------------------------------------------- | |
# First, failing, attempt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As explained in this talk by lizmat, | |
<https://www.youtube.com/watch?v=VoxWnNJ0gTI&t=8440s>, to speed up the | |
launch time of a Raku script, one can write all of its MAIN logic in a | |
module, make sure sub MAIN is exported, and create a script that | |
simply "use"s the module (the talk is more general and worth | |
watching). The launch time speedup will occur once the program has | |
been run at least once, since its modules will have been precompiled, | |
as opposed to the script itself. | |
But what if we want to have a custom USAGE() function? We can write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" -------------------------------------------------------------------- | |
" Execute the text that is visually highlighted. This is very practical | |
" when wanting to try out stuff one may want to put in their .vimrc file | |
" or something. | |
function! ExecHighlighted () range | |
" Grab the highlighted text: save the contents of an arbitrary | |
" register, yank the highlighted text to it, copy the register | |
" contents to a local variable, and restore the register |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" -------------------------------------------------------------------- | |
" Toggle 「/*⋯*/」 style one line comments. | |
nnoremap <silent> <Plug>CStyleOneLine | |
\ ^:if search('/\*.*\*/', 'c', line(".")) != 0<cr> | |
\ :.s,/\* *\(.\{-}\) *\*/,\1,g<cr> | |
\ :else<cr> | |
\ :.s,\(\s*\)\(.*\)\(\s*\),\1/\* \2 \*/\3,g<cr> | |
\ :endif<cr> | |
\ :noh<cr> |
NewerOlder