Skip to content

Instantly share code, notes, and snippets.

View IceDragon200's full-sized avatar

Corey Powell IceDragon200

View GitHub Profile

So here is my 2 cents in response to https://wiki.alopex.li/ElixirNitpicks:

Error Handling:

  • Every language I've known has the same statement: Don't use exceptions if you can.
  • That applies to Elixir as well, the preferred way to handle "expected" errors is by returning an error tuple: {:error, term}, bonus points if the term is a struct that provides more information on said error.
  • Exceptions should only happen when the code enters a state it straight up can't handle (think completely corrupt state, dead connections, unexpected failures, failed assertions, etc).
  • The above is where the "Let it crash" comes in, literally just that, let it crash and let your application pick up where it last (safely) left off.
  • It's easier to debug if it fails outright, sometimes the best error handling is none at all (just capture success and let it crash otherwise)

State Management:

At a glance, too inconsistent, BD shines being a monotype ED (i.e. pure fusion), I'd even throw out DPE, FD is not worth the trouble when Mirrorjade is all round the better option in most cases, and Despia can easily float it several times over the course of the match (Ad Lib. or Theater for example, since people can't read for some reason)

While it's cute to have supply stash to draw 1, Despia is already pretty good at generating card advantage through other options, almost everything either searches or floats in some way.

Anyway, I personally gave up on handtraps (a combination of bricking, and getting called-by constantly does that to a guy), the only ones I keep are called by and imperm.

Decklist (core): Monsters:

  • 3x Aluber the Jester of Despia
  • 3x Fallen of Albaz
@IceDragon200
IceDragon200 / 01-example.kdl
Created October 25, 2021 02:03
KDL Data Model example (from Kuddle)
// This is an example document to demonstrate the data model result
document date=(date)"2021-10-24" {
numbers {
integer 12
bin 0b1000_1000
oct 0o7453
hex 0xDEADBEEF
}
strings {
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
@IceDragon200
IceDragon200 / bench_startup.exs
Created October 9, 2020 00:07
A small elixir script for bench marking the startup times of applications, specify the top-level app and this will print the slowest application in the tree
excluded = [:stdlib, :kernel, :compiler]
bench_startup = fn bench_startup, acc, app ->
if acc[app] do
acc
else
apps = Application.spec(app, :applications) -- excluded
inc_apps = Application.spec(app, :included_applications) -- excluded
all_apps = apps ++ inc_apps
local function dump_nodes()
-- Export all node names to a text file for review
print("Exporting Nodes")
local i = 0
local result = {}
for name, _def in pairs(minetest.registered_nodes) do
i = i + 1
result[i] = name
end
CavesRandomWalk::makeCave (this=0x7fffb0d3c6c0, vm=0x7fff9c585d70, nmin=..., nmax=..., ps=0x7fffb0d3c6a0, is_large_cave=true, max_stone_height=10, heightmap=0x555557ca15d0)
at <REDACTED>/minetest/src/mapgen/cavegen.cpp:334
334 if (biome->c_cave_liquid[0] != CONTENT_IGNORE) {
(gdb) backtrace
#0 CavesRandomWalk::makeCave (this=0x7fffb0d3c6c0, vm=0x7fff9c585d70, nmin=..., nmax=..., ps=0x7fffb0d3c6a0, is_large_cave=true, max_stone_height=10, heightmap=0x555557ca15d0)
at <REDACTED>/minetest/src/mapgen/cavegen.cpp:334
#1 0x0000555555e7c236 in MapgenBasic::generateCavesRandomWalk (this=0x555557c9f600, max_stone_y=10, large_cave_ymax=-33)
at <REDACTED>/minetest/src/mapgen/mapgen.cpp:891
#2 0x0000555555ea03d9 in MapgenV7::makeChunk (this=0x555557c9f600, data=0x7fffb0d3c880) at <REDACTED>/minetest/src/mapgen/mapgen_v7.cpp:376
#3 0x00005555560a8976 in EmergeThread::run (this=0x5555576e1e30) at <REDACTED>/minetest/src/emerge.cpp:696
local EnergySystem = {}
local ic = EnergySystem
-- borrowed from YATM
local D_NORTH = 1 -- +Z
local D_EAST = 2 -- +X
local D_SOUTH = 4 -- -Z
local D_WEST = 8 -- -X
local D_DOWN = 16 -- -Y
local D_UP = 32 -- +Y
{
'AL': "Alabama",
'AK': "Alaska",
'AZ': "Arizona",
'AR': "Arkansas",
'CA': "California",
'CO': "Colorado",
'CT': "Connecticut",
'DE': "Delaware",
'DC': "District Of Columbia",
@IceDragon200
IceDragon200 / grc-fermenting-2.7.json
Created August 21, 2016 12:41
A snippet from Growthcraft 2.7's fermenting.json
{
"comment": "",
"data": [
{
"comment": "",
"item": {
"ore": "yeastBrewers",
"comment": "",
"mod_id": null,
"name": null,