From 325ac015a3818bf1bbc550f729e9852afe2d7ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Galy-Fajou?= Date: Thu, 21 Dec 2023 21:15:18 +0100 Subject: [PATCH] A whole new world (#41) * Add a bunch of new emoji * Emojify source code --------- Co-authored-by: @adrhill --- .github/workflows/CI.yml | 3 + README.md | 160 +++++++++++------- src/WatchJuliaBurn.jl | 6 +- "src/\360\237\223\226.jl" | 45 ++++- ...37\230\203\342\206\222\360\237\227\277.jl" | 33 ++-- ...31\210\360\237\231\212\360\237\231\211.jl" | 2 +- test/runtests.jl | 10 +- .../\360\237\221\242\360\237\216\200.jl" | 29 ++-- 8 files changed, 174 insertions(+), 114 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3e6b45d..8a3565d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,6 +19,9 @@ jobs: - '1.3' - '1.4' - '1.5' + - '1.6' + - '1.7' + - '1.8' - '1' - 'nightly' os: diff --git a/README.md b/README.md index f81cee2..3d967df 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ For a serious use of unicode characters see also [Ueauty.jl](https://gitlab.com/ ## Add your own awfulness! -Don't hesitate to add your worst creations via PR. All you need to do is to add the function and emoji to the `func_to_emojis` internal `Dict`. Don't touch the `README`! +Don't hesitate to add your worst creations via PR. All you need to do is to add the function and emoji to the `๐Ÿ˜ƒ๐Ÿ“–` internal `๐Ÿ“–` in `src/๐Ÿ“–.jl`. Don't touch the `README`! It will be automatically generated after your PR is merged. Also tests are optional since tests are for losers! ## Emojify your code You can use the `emojify` function to recursively emojify all the files in a given path. `emojify` will replace all functions for which an alias is known -by the corresponding emoji (a random one is picked every time if multiple options are possible). +by the corresponding emoji (a random one is picked every โฒ๏ธ if multiple options are possible). For example: ```julia @@ -22,73 +22,103 @@ vcat(round(log(pi)), broadcast(tan โˆ˜ inv, rand(3))) will return ```julia -โฌ‡๏ธ๐Ÿ˜ป(๐Ÿ”ต(๐Ÿชต(๐Ÿฅง)), ๐Ÿ“ก(๐Ÿง‘๐Ÿปโžก๏ธ๐Ÿง‘๐Ÿฝ โˆ˜ โ†”, ๐ŸŽฒ(3))) +โฌ‡๏ธ๐Ÿ˜ป(๐ŸŽ (๐Ÿชต(๐Ÿฐ)), ๐Ÿ“ก(๐Ÿง‘๐Ÿปโžก๏ธ๐Ÿง‘๐Ÿฝ โˆ˜ โ†”, ๐ŸŽฒ(3))) ``` ## List of emojis -| Function | Emojis | Julia Version | -| --------------------:| --------------:| -------------:| -| `ArgumentError` | ๐Ÿ’ฌ๐Ÿšจ | | -| `Dict` | ๐Ÿ“– | | -| `Matrix` | ๐Ÿ”ข | | -| `Threads` | ๐Ÿงต | | -| `abs` | ๐Ÿ‘”๐Ÿ’ช, ๐ŸŽฝ๐Ÿ’ช | | -| `axes` | ๐Ÿช“๐Ÿช“ | 1.2 | -| `broadcast` | ๐Ÿ“ก | | -| `cat` | ๐Ÿ˜ป, ๐Ÿ˜น, ๐Ÿˆ | | -| `cd` | ๐Ÿ’ฟ | | -| `chop` | ๐ŸŒณ๐Ÿช“ | 1.2 | -| `clamp` | ๐Ÿ—œ๏ธ | | -| `collect` | ๐Ÿงบ | | -| `cot` | ๐Ÿงฅ, ๐Ÿฅผ | | -| `count` | ๐Ÿงฎ | | -| `count_ones` | ๐Ÿงฎ1๏ธโƒฃ1๏ธโƒฃ | | -| `count_zeros` | ๐Ÿงฎ0๏ธโƒฃ0๏ธโƒฃ | | -| `delete!` | ๐Ÿ”ฅ | | -| `download` | ๐Ÿ“ฅ | | -| `error` | ๐Ÿ’ฃ | | -| `exit` | ๐Ÿšช | | -| `false` | ๐Ÿ‘Ž | | -| `fill` | ๐Ÿšฐ | | -| `findall` | ๐Ÿ•ต๏ธ | | -| `findfirst` | ๐Ÿ”Ž๐Ÿฅ‡ | | -| `findnext` | ๐Ÿ”Žโญ | | -| `first` | ๐Ÿฅ‡ | | -| `float` | โ›ต๏ธ | | -| `foldr` | ๐Ÿ—‚, ๐Ÿ“ | | -| `hcat` | โžก๏ธ๐Ÿ˜ป, โžก๏ธ๐Ÿ˜น, โžก๏ธ๐Ÿˆ | | -| `imag` | ๐Ÿ”ฎ | | -| `inv` | โ†” | | -| `isreal` | ๐Ÿ›ธโ“ | | -| `join` | ๐Ÿšช๐Ÿšถ | | -| `keys` | ๐Ÿ”‘, ๐Ÿ— | | -| `kill` | โšฐ๏ธ | | -| `log` | ๐Ÿชต | 1.5 | -| `map` | ๐Ÿ—บ | | -| `mean โˆ˜ skipmissing` | ๐Ÿ˜  | | -| `mod` | ๐Ÿ›ต๐Ÿ”ง | | -| `nothing` | โฌ› | | -| `peek` | โ›ฐ๏ธ | 1.5 | -| `pi` | ๐Ÿฅง, ๐Ÿฐ | | -| `pop!` | ๐Ÿพ, ๐Ÿน๐ŸŽˆ | | -| `print` | ๐Ÿ–จ๏ธ | | -| `rand` | ๐ŸŽฐ, ๐ŸŽฒ | | -| `raw` | ๐Ÿฅฉ | | -| `round` | ๐ŸŽ , ๐Ÿ”ต | | -| `run` | ๐Ÿƒ | | -| `show` | โ˜๏ธ | | -| `sign` | ๐Ÿชง, ๐Ÿš | 1.5, 1.5 | -| `sleep` | ๐Ÿ˜ด, ๐Ÿ’ค | | -| `string` | ๐ŸŽป | | -| `tan` | ๐Ÿง‘๐Ÿปโžก๏ธ๐Ÿง‘๐Ÿฝ, ๐Ÿ‘ฉ๐Ÿปโžก๏ธ๐Ÿ‘ฉ๐Ÿฝ | | -| `throw` | cโ•ฏยฐโ–กยฐโ†„โ•ฏ, ๐Ÿคฎ, ๐Ÿšฎ | | -| `time` | โฑ๏ธ, โŒ›, โฒ๏ธ | | -| `true` | โœ…, ๐Ÿ‘, ๐Ÿ‘Œ | | -| `vcat` | โฌ‡๏ธ๐Ÿ˜ป, โฌ‡๏ธ๐Ÿ˜น, โฌ‡๏ธ๐Ÿˆ | | -| `view` | ๐Ÿ‘€, ๐Ÿ‘๏ธ | | -| `write` | ๐Ÿ–Š๏ธ, โœ๏ธ, ๐Ÿ–‹๏ธ | | -| `zip` | ๐Ÿค | | +| Function | Emojis | Julia Version | +| --------------------:| -------------------------------:| -------------:| +| `AbstractChar` | ๐Ÿซฅ๐Ÿš— | | +| `AbstractDict` | ๐Ÿซฅ๐Ÿ“– | | +| `AbstractDisplay` | ๐Ÿซฅ๐Ÿ“บ | | +| `AbstractFloat` | ๐Ÿซฅ๐Ÿ›Ÿ | | +| `AbstractMatrix` | ๐Ÿซฅ๐Ÿ”ข | | +| `AbstractString` | ๐Ÿซฅ๐Ÿงต | | +| `ArgumentError` | ๐Ÿ’ฌ๐Ÿšจ | | +| `Bool` | ๐Ÿ‘๐Ÿ‘Ž | | +| `Char` | ๐Ÿš— | | +| `Dict` | ๐Ÿ“– | | +| `ENV` | ๐Ÿงง | | +| `IO` | ๐Ÿช€ยฝ, ๐Ÿ‘๏ธ๐Ÿ˜ฒ | | +| `Matrix` | ๐Ÿ”ข | | +| `String` | ๐Ÿงต | | +| `Threads` | ๐Ÿชข | | +| `abs` | ๐Ÿ‘”๐Ÿ’ช, ๐ŸŽฝ๐Ÿ’ช | | +| `any` | ๐Ÿ‘ฉ | | +| `axes` | ๐Ÿช“๐Ÿช“ | 1.2 | +| `broadcast` | ๐Ÿ“ก | | +| `cat` | ๐Ÿ˜ป, ๐Ÿ˜น, ๐Ÿˆ | | +| `cd` | ๐Ÿ’ฟ, ๐Ÿ‡จ๐Ÿ‡ฉ | | +| `chop` | ๐Ÿฅข, ๐ŸŒณ๐Ÿช“ | 1, 1.2 | +| `clamp` | ๐Ÿ—œ๏ธ | | +| `collect` | ๐Ÿงบ | | +| `cot` | ๐Ÿงฅ, ๐Ÿฅผ | | +| `count` | ๐Ÿงฎ | | +| `count_ones` | ๐Ÿงฎ1๏ธโƒฃ1๏ธโƒฃ | | +| `count_zeros` | ๐Ÿงฎ0๏ธโƒฃ0๏ธโƒฃ | | +| `delete!` | ๐Ÿ”ฅ | | +| `display` | ๐Ÿ“บ | | +| `div` | (Symbol(Char(0x0001f93f)), 1.2) | | +| `download` | ๐Ÿ“ฅ | | +| `dump` | ๐Ÿ’ฉ | | +| `eachindex` | โ˜๏ธโ˜๏ธ | | +| `error` | ๐Ÿ’ฃ | | +| `exit` | ๐Ÿšช | | +| `false` | ๐Ÿ‘Ž | | +| `fill` | ๐Ÿšฐ | | +| `findall` | ๐Ÿ•ต๏ธ | | +| `findfirst` | ๐Ÿ”Ž๐Ÿฅ‡ | | +| `findnext` | ๐Ÿ”Žโญ | | +| `first` | ๐Ÿฅ‡ | | +| `float` | โ›ต๏ธ, ๐Ÿ›Ÿ | | +| `flush` | ๐Ÿ˜ณ | | +| `foldr` | ๐Ÿ—‚, ๐Ÿ“ | | +| `get` | ๐Ÿคฒ | | +| `getfield` | ๐Ÿคฒ๐ŸŒฝ, ๐Ÿคฒ๐ŸŒพ | | +| `getglobal` | ๐Ÿคฒ๐ŸŒ | | +| `getindex` | ๐Ÿคฒโ˜๏ธ | | +| `getkey` | ๐Ÿคฒ๐Ÿ”‘, ๐Ÿคฒ๐Ÿ— | | +| `getproperty` | ๐Ÿคฒ๐Ÿก | | +| `hcat` | โžก๏ธ๐Ÿ˜ป, โžก๏ธ๐Ÿ˜น, โžก๏ธ๐Ÿˆ | | +| `im` | ๐Ÿ‡ฎ๐Ÿ‡ฒ | | +| `imag` | ๐Ÿ”ฎ | | +| `inv` | โ†” | | +| `isreal` | ๐Ÿ›ธโ“ | | +| `join` | ๐Ÿšช๐Ÿšถ | | +| `keys` | ๐Ÿ”‘, ๐Ÿ— | | +| `kill` | โšฐ๏ธ | | +| `length` | ๐Ÿ“ | | +| `log` | ๐Ÿชต | 1.5 | +| `map` | ๐Ÿ—บ | | +| `mean โˆ˜ skipmissing` | ๐Ÿ˜  | | +| `mod` | ๐Ÿ›ต๐Ÿ”ง | | +| `nothing` | โฌ› | | +| `peek` | โ›ฐ๏ธ | 1.5 | +| `pi` | ๐Ÿฅง, ๐Ÿฐ | | +| `pop!` | ๐Ÿพ, ๐Ÿน๐ŸŽˆ | | +| `print` | ๐Ÿ–จ๏ธ | | +| `push!` | ๐Ÿ‹๏ธ | | +| `rand` | ๐ŸŽฐ, ๐ŸŽฒ | | +| `raw` | ๐Ÿฅฉ | | +| `round` | ๐ŸŽ , ๐Ÿ”ต | | +| `run` | ๐Ÿƒ | | +| `searchsorted` | ๐Ÿ”Ž๐Ÿ”ค | | +| `secd` | ๐Ÿฅˆ | | +| `show` | โ˜๏ธ | | +| `sign` | ๐Ÿชง, ๐Ÿš | 1.5, 1.5 | +| `sleep` | ๐Ÿ˜ด, ๐Ÿ’ค | | +| `sort` | ๐Ÿ”ค | | +| `string` | ๐ŸŽป | | +| `tan` | ๐Ÿง‘๐Ÿปโžก๏ธ๐Ÿง‘๐Ÿฝ, ๐Ÿ‘ฉ๐Ÿปโžก๏ธ๐Ÿ‘ฉ๐Ÿฝ | | +| `throw` | cโ•ฏยฐโ–กยฐโ†„โ•ฏ, ๐Ÿคฎ, ๐Ÿšฎ | | +| `time` | ๐Ÿ•›, โฑ๏ธ, โŒ›, โฒ๏ธ | | +| `tr` | ๐Ÿ‡น๐Ÿ‡ท | | +| `true` | โœ…, ๐Ÿ‘, ๐Ÿ‘Œ | | +| `vcat` | โฌ‡๏ธ๐Ÿ˜ป, โฌ‡๏ธ๐Ÿ˜น, โฌ‡๏ธ๐Ÿˆ | | +| `view` | ๐Ÿ‘€, ๐Ÿ‘๏ธ | | +| `write` | ๐Ÿ–Š๏ธ, โœ๏ธ, ๐Ÿ–‹๏ธ | | +| `zip` | ๐Ÿค | | ## Control Flow You can now replace boring old try/catch/finally clauses with fancy monkey flow! diff --git a/src/WatchJuliaBurn.jl b/src/WatchJuliaBurn.jl index d2e98e6..7e0a019 100644 --- a/src/WatchJuliaBurn.jl +++ b/src/WatchJuliaBurn.jl @@ -42,8 +42,8 @@ end include("๐Ÿ“–.jl") -for func in keys(func_to_emojis) - for symbol_info in func_to_emojis[func] +for func in keys(๐Ÿ˜ƒ๐Ÿ“–) + for symbol_info in ๐Ÿ˜ƒ๐Ÿ“–[func] if symbol_info isa Symbol @eval @new_emoji $(symbol_info) $(func) elseif symbol_info isa Tuple @@ -54,7 +54,7 @@ end ## Additional features (does not pass with @new_emoji) @eval $(Symbol("@๐Ÿฅฉ_str")) = $(getfield(Main, Symbol("@raw_str"))) -func_to_emojis[:(raw)] = (:(๐Ÿฅฉ),) +๐Ÿ˜ƒ๐Ÿ“–[:(raw)] = (:(๐Ÿฅฉ),) emoji_to_func[:(๐Ÿฅฉ"")] = (:(raw""), "") include("๐Ÿ˜ƒโ†’๐Ÿ—ฟ.jl") diff --git "a/src/\360\237\223\226.jl" "b/src/\360\237\223\226.jl" index 4b1ac09..386090c 100644 --- "a/src/\360\237\223\226.jl" +++ "b/src/\360\237\223\226.jl" @@ -1,17 +1,31 @@ -## Contains mapping from functions to func_to_emojis +## Contains mapping from functions to ๐Ÿ˜ƒ๐Ÿ“– ## Each function (treated as a Symbol) maps to a Tuple of Symbols and Tuple{Symbol,Float64} for ## emojis needing a specific version -const func_to_emojis = ๐Ÿ“–( +const ๐Ÿ˜ƒ๐Ÿ“– = ๐Ÿ“–( ## Base :ENV => (:(๐Ÿงง),), + # Symbol(Char(0x1fae5)) :ArgumentError => (:(๐Ÿ’ฌ๐Ÿšจ),), + :AbstractChar => ((Symbol(Char(0x1fae5) * '๐Ÿš—'), 1.8),), + :AbstractDict => ((Symbol(Char(0x1fae5) * '๐Ÿ“–'), 1.8),), + :AbstractDisplay => ((Symbol(Char(0x1fae5) * '๐Ÿ“บ'), 1.8),), + :AbstractFloat => ((Symbol(Char(0x1fae5) * Char(0x1f6df)), 1.8),), + :AbstractString => ((Symbol(Char(0x1fae5) * '๐Ÿงต'), 1.8),), + :Bool => (:(๐Ÿ‘๐Ÿ‘Ž),), + :Char => (:(๐Ÿš—),), :Dict => (:(๐Ÿ“–),), - :Threads => (:(๐Ÿงต),), + :IO => ((Symbol(Char(0x1fa80) * 'ยฝ'), 1.2), :(๐Ÿ‘๏ธ๐Ÿ˜ฒ),), # ๐Ÿช€ยฝ + :Pair => (:(๐Ÿ),), + :Threads => ((Symbol(Char(0x1faa2)), 1.5),), + :String => (:(๐Ÿงต),), + :any => (:(๐Ÿ‘ฉ),), # (her name is Annie) :broadcast => (:(๐Ÿ“ก),), - :cd => (:(๐Ÿ’ฟ),), - :chop => (:(๐Ÿฅข), (Symbol(Char(0x0001f333) * Char(0x0001fa93)), 1.2),), # ๐ŸŒณ๐Ÿช“ + :cd => (:(๐Ÿ’ฟ), :(๐Ÿ‡จ๐Ÿ‡ฉ)), + :chop => (:(๐Ÿฅข), (Symbol(Char(0x1f333) * Char(0x1fa93)), 1.2),), # ๐ŸŒณ๐Ÿช“ :delete! => (:(๐Ÿ”ฅ),), + :display => (:(๐Ÿ“บ),), :download => (:(๐Ÿ“ฅ),), + :dump => (:(๐Ÿ’ฉ),), :error => (:(๐Ÿ’ฃ),), :exit => (:(๐Ÿšช),), :false => (:๐Ÿ‘Ž,), @@ -22,32 +36,43 @@ const func_to_emojis = ๐Ÿ“–( :flush => (:(๐Ÿ˜ณ),), :foldr => (:(๐Ÿ—‚), :(๐Ÿ“),), :get => (:(๐Ÿคฒ),), + :getfield => (:(๐Ÿคฒ๐ŸŒฝ), (:๐Ÿคฒ๐ŸŒพ),), + :getkey => (:(๐Ÿคฒ๐Ÿ”‘), :(๐Ÿคฒ๐Ÿ—),), + :getproperty => (:(๐Ÿคฒ๐Ÿก),), :join => (:(๐Ÿšช๐Ÿšถ),), :keys => (:(๐Ÿ”‘), :(๐Ÿ—),), :kill => (:(โšฐ๏ธ),), :map => (:(๐Ÿ—บ),), :nothing => (:(โฌ›),), :peek => ((:(โ›ฐ๏ธ), 1.5),), - :pop! => (:(๐Ÿพ), :(๐Ÿน๐ŸŽˆ)), :print => (:(๐Ÿ–จ๏ธ),), :rand => (:(๐ŸŽฐ),:(๐ŸŽฒ),), :run => (:(๐Ÿƒ),), + :searchsorted => (:(๐Ÿ”Ž๐Ÿ”ค),), :show => (:(โ˜๏ธ),), :sleep => (:(๐Ÿ˜ด), :(๐Ÿ’ค),), + :sort => (:(๐Ÿ”ค),), :string => (:(๐ŸŽป),), :throw => (:(cโ•ฏยฐโ–กยฐโ†„โ•ฏ), :(๐Ÿคฎ), :(๐Ÿšฎ),), :time => (:(๐Ÿ•›), :(โฑ๏ธ), :(โŒ›), :(โฒ๏ธ),), :true => (:(โœ…), :(๐Ÿ‘), :(๐Ÿ‘Œ),), :write => (:(๐Ÿ–Š๏ธ), :(โœ๏ธ), :(๐Ÿ–‹๏ธ),), :zip => (:(๐Ÿค),), - ## Arrays + ## Arrays and iterators + :AbstractMatrix => ((Symbol(Char(0x1fae5) * '๐Ÿ”ข'), 1.8),), :Matrix => (:(๐Ÿ”ข),), :axes => ((Symbol(Char(0x1fa93)^2), 1.2),), # ๐Ÿช“๐Ÿช“ :cat => (:(๐Ÿ˜ป), :(๐Ÿ˜น), :(๐Ÿˆ),), :vcat => (:(โฌ‡๏ธ๐Ÿ˜ป), :(โฌ‡๏ธ๐Ÿ˜น), :(โฌ‡๏ธ๐Ÿˆ),), :hcat => (:(โžก๏ธ๐Ÿ˜ป), :(โžก๏ธ๐Ÿ˜น), :(โžก๏ธ๐Ÿˆ),), :collect => (:(๐Ÿงบ),), + :eachindex => (:(โ˜๏ธโ˜๏ธ),), :fill => (:(๐Ÿšฐ),), + :getindex => (:(๐Ÿคฒโ˜๏ธ),), + :push! => (:(๐Ÿ‹๏ธ),), + :pop! => (:(๐Ÿพ), :(๐Ÿน๐ŸŽˆ)), + :length => (:(๐Ÿ“),), + :view => (:(๐Ÿ‘€), :(๐Ÿ‘๏ธ),), ## Math :abs => ((:๐Ÿ‘”๐Ÿ’ช),(:๐ŸŽฝ๐Ÿ’ช),), :clamp => (:(๐Ÿ—œ๏ธ),), @@ -56,7 +81,8 @@ const func_to_emojis = ๐Ÿ“–( :count_ones => (:(๐Ÿงฎ1๏ธโƒฃ1๏ธโƒฃ),), :count_zeros => (:(๐Ÿงฎ0๏ธโƒฃ0๏ธโƒฃ),), :div => (:(Symbol(Char(0x1f93f)), 1.2),), # ๐Ÿคฟ - :float => ((:โ›ต๏ธ),), + :float => (:(โ›ต๏ธ), (Symbol(Char(0x1f6df)), 1.8),), # ๐Ÿ›Ÿ + :im => (:(๐Ÿ‡ฎ๐Ÿ‡ฒ),), # Island of Man flag :imag => (:(๐Ÿ”ฎ),), :inv => (:(โ†”),), :isreal => ((:๐Ÿ›ธโ“),), @@ -65,7 +91,8 @@ const func_to_emojis = ๐Ÿ“–( :mod => (:(๐Ÿ›ต๐Ÿ”ง),), :pi => (:(๐Ÿฅง), :(๐Ÿฐ),), :round => (:(๐ŸŽ ), :(๐Ÿ”ต),), + :secd => (:(๐Ÿฅˆ),), :sign => ((Symbol(Char(0x1faa7)), 1.5),(Symbol(Char(0x1f68f)), 1.5),), # ๐Ÿชง, ๐Ÿš :tan => (:(๐Ÿง‘๐Ÿปโžก๏ธ๐Ÿง‘๐Ÿฝ), :(๐Ÿ‘ฉ๐Ÿปโžก๏ธ๐Ÿ‘ฉ๐Ÿฝ),), - :view => (:(๐Ÿ‘€), (:๐Ÿ‘๏ธ),), + :tr => (:(๐Ÿ‡น๐Ÿ‡ท),), ) diff --git "a/src/\360\237\230\203\342\206\222\360\237\227\277.jl" "b/src/\360\237\230\203\342\206\222\360\237\227\277.jl" index 6e50362..cb96e6e 100644 --- "a/src/\360\237\230\203\342\206\222\360\237\227\277.jl" +++ "b/src/\360\237\230\203\342\206\222\360\237\227\277.jl" @@ -1,10 +1,10 @@ """ - emojify(path::String) + emojify(path::๐Ÿงต) Go recursively over all the files contained in path and replace all possible occurence of functions with random emoji aliases """ -function emojify(path::String; overwrite=๐Ÿ‘Œ) +function emojify(path::๐Ÿงต; overwrite=๐Ÿ‘Œ) if isdir(path) for subpath in readdir(path) emojify(joinpath(path, subpath); overwrite=overwrite) @@ -15,8 +15,8 @@ function emojify(path::String; overwrite=๐Ÿ‘Œ) return โฌ› end -function emojify_file(filepath::String; overwrite=๐Ÿ‘) - str = String(read(filepath)) +function emojify_file(filepath::๐Ÿงต; overwrite=๐Ÿ‘) + str = ๐Ÿงต(read(filepath)) str = emojify_string(str) if overwrite ๐Ÿ–Š๏ธ(filepath, str) @@ -26,26 +26,19 @@ function emojify_file(filepath::String; overwrite=๐Ÿ‘) end end -function emojify_string(str::String) - for func in ๐Ÿ”‘(func_to_emojis) - str = replace(str, Regex("\\b" * ๐ŸŽป(func) * "\\b") => RandString(to_string.(func_to_emojis[func]))) +function emojify_string(str::๐Ÿงต) + for func in ๐Ÿ”‘(๐Ÿ˜ƒ๐Ÿ“–) + str = replace(str, Regex("\\b" * ๐ŸŽป(func) * "\\b") => ๐ŸŽฐ๐Ÿงต(๐Ÿฅˆ๐ŸŽป.(๐Ÿ˜ƒ๐Ÿ“–[func]))) end return str end -function to_string(emoji::Symbol) - ๐ŸŽป(emoji) -end - -function to_string(emoji::Tuple) - return ๐ŸŽป(emoji[1]) -end +๐Ÿฅˆ๐ŸŽป(๐Ÿ˜ƒ::Union{Symbol,Expr}) = ๐ŸŽป(๐Ÿ˜ƒ) +๐Ÿฅˆ๐ŸŽป(๐Ÿ˜ƒ::Tuple) = ๐ŸŽป(๐Ÿฅ‡(๐Ÿ˜ƒ)) -## Allow to get a random ๐ŸŽป every โฒ๏ธ it's printed -struct RandString{TS} - strings::TS +## Allow to ๐Ÿคฒ a random ๐ŸŽป every โฒ๏ธ it's printed +struct ๐ŸŽฐ๐Ÿงต{T๐Ÿงต} # RandString + ๐ŸŽป๐ŸŽป๐ŸŽป::T๐Ÿงต end -function ๐Ÿ–จ๏ธ(io::IO, rs::RandString) - ๐Ÿ–จ๏ธ(io, ๐ŸŽฒ(rs.strings)) -end +๐Ÿ–จ๏ธ(io::๐Ÿ‘๏ธ๐Ÿ˜ฒ, rs::๐ŸŽฐ๐Ÿงต) = ๐Ÿ–จ๏ธ(io, ๐ŸŽฒ(rs.๐ŸŽป๐ŸŽป๐ŸŽป)) diff --git "a/src/\360\237\231\210\360\237\231\212\360\237\231\211.jl" "b/src/\360\237\231\210\360\237\231\212\360\237\231\211.jl" index 9e2ff83..7b1dc83 100644 --- "a/src/\360\237\231\210\360\237\231\212\360\237\231\211.jl" +++ "b/src/\360\237\231\210\360\237\231\212\360\237\231\211.jl" @@ -53,7 +53,7 @@ macro ๐Ÿ’(monkeyexpression::Expr) elseif sub isa Expr && sub.args[1] == :๐Ÿ™Š state = :catch catchblock = Expr(:block) - if length(sub.args) == 2 + if ๐Ÿ“(sub.args) == 2 catchme = sub.args[2] else ๐Ÿ’ฃ("Can only catch a single ๐Ÿ’ฃ at once, duh!") diff --git a/test/runtests.jl b/test/runtests.jl index b0d8c8d..7b7857d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -53,9 +53,17 @@ using LinearAlgebra @test ๐Ÿ›ธโ“(1im) == ๐Ÿ‘Ž @test ๐Ÿ”ฎ(1 + 2im) == 2 + strip_version(x::Tuple) = first(x) + strip_version(x::Union{Symbol, Expr}) = x + + # Check that symbols are not used twice. + @test Base.allunique(mapreduce(vcat, values(WatchJuliaBurn.๐Ÿ˜ƒ๐Ÿ“–)) do ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ + strip_version.(๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ) + end) + ## Monkey try/catch/finally include("๐Ÿ’tests.jl") - + # Arbitrary pointers don't segfault on read @test sum(unsafe_load(arbitrary_pointer()) for _ in 1:10_000_000) != 1729 diff --git "a/\360\237\223\234/\360\237\221\242\360\237\216\200.jl" "b/\360\237\223\234/\360\237\221\242\360\237\216\200.jl" index ad1b2e4..d4305c2 100644 --- "a/\360\237\223\234/\360\237\221\242\360\237\216\200.jl" +++ "b/\360\237\223\234/\360\237\221\242\360\237\216\200.jl" @@ -1,24 +1,23 @@ using Latexify using WatchJuliaBurn -ord_keys = sort(collect(WatchJuliaBurn.func_to_emojis), by=x->string(x[1])) -function to_string(emojis) - join([emoji isa Tuple ? string(emoji[1]) : string(emoji) for emoji in emojis], ", ") +ord_keys = ๐Ÿ”ค(๐Ÿงบ(WatchJuliaBurn.๐Ÿ˜ƒ๐Ÿ“–), by=x->๐ŸŽป(๐Ÿฅ‡(x))) +function ๐Ÿฅˆ๐ŸŽป(๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ) + ๐Ÿšช๐Ÿšถ([๐Ÿ˜ƒ isa Tuple ? ๐ŸŽป(๐Ÿฅ‡(๐Ÿ˜ƒ)) : ๐ŸŽป(๐Ÿ˜ƒ) for ๐Ÿ˜ƒ in ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ], ", ") end -function to_version(emojis) - if any(x->x isa Tuple, emojis) - return join([emoji isa Tuple ? string(emoji[2]) : "1" for emoji in emojis], ", ") +function ๐Ÿฅˆversion(๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ) + if ๐Ÿ‘ฉ(x->x isa Tuple, ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ) + return ๐Ÿšช๐Ÿšถ([๐Ÿ˜ƒ isa Tuple ? ๐ŸŽป(๐Ÿ˜ƒ[2]) : "1" for ๐Ÿ˜ƒ in ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ], ", ") else return "" end end - -ar = reduce(vcat, ['`' * string(key) * '`' to_string(emojis) to_version(emojis)] - for (key, emojis) in ord_keys) -ar = vcat(["Function" "Emojis" "Julia Version"], ar) -md_ar = md(ar; latex=false) +ar = reduce(โฌ‡๏ธ๐Ÿ˜ป, ['`' * ๐ŸŽป(๐Ÿ”‘) * '`' ๐Ÿฅˆ๐ŸŽป(๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ) ๐Ÿฅˆversion(๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ)] + for (๐Ÿ”‘, ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ) in ord_keys) +ar = โฌ‡๏ธ๐Ÿ˜ป(["Function" "Emojis" "Julia Version"], ar) +md_ar = md(ar; latex=๐Ÿ‘Ž) code_snippet = "vcat(round(log(pi)), broadcast(tan โˆ˜ inv, rand(3)))" @@ -31,13 +30,13 @@ For a serious use of unicode characters see also [Ueauty.jl](https://gitlab.com/ ## Add your own awfulness! -Don't hesitate to add your worst creations via PR. All you need to do is to add the function and emoji to the `func_to_emojis` internal `Dict`. Don't touch the `README`! +Don't hesitate to add your worst creations via PR. All you need to do is to add the function and emoji to the `๐Ÿ˜ƒ๐Ÿ“–` internal `๐Ÿ“–` in `src/๐Ÿ“–.jl`. Don't touch the `README`! It will be automatically generated after your PR is merged. Also tests are optional since tests are for losers! ## Emojify your code You can use the `emojify` function to recursively emojify all the files in a given path. `emojify` will replace all functions for which an alias is known -by the corresponding emoji (a random one is picked every time if multiple options are possible). +by the corresponding emoji (a random one is picked every โฒ๏ธ if multiple options are possible). For example: ```julia @@ -78,10 +77,10 @@ You can use the [EmojiSymbols.jl](https://github.com/wookay/EmojiSymbols.jl) pac # Overwrite the README open(joinpath(@__DIR__, "..", "README.md"), "w") do io - write(io, intro * string(md_ar) * outro) + ๐Ÿ–Š๏ธ(io, intro * ๐ŸŽป(md_ar) * outro) end # Emojify all the src files of WatchJuliaBurn. foreach(walkdir(joinpath(pkgdir(WatchJuliaBurn), "src"))) do (root, dirs, files) foreach(emojify, joinpath.(root, filter(!โˆˆ(["๐Ÿ“–.jl", "WatchJuliaBurn.jl"]), files))) -end \ No newline at end of file +end