Skip to content

Instantly share code, notes, and snippets.

View atengberg's full-sized avatar

atengberg atengberg

  • sidereal
View GitHub Profile
@atengberg
atengberg / self.note.md
Last active May 15, 2024 10:47
note to self may15ish - js
// Don't do this:
const badHoleyArray = new Array(10);

Will be forevermore marked as HOLEY (cannot be undone by filling the holes!) and preclude engine's optimizations for arrays.

idea for meme (stages revolutions)

avoid making yourself less employable through evaluation of self hypocrisy, first.

see previous.

then avoid rhetorical rationaliz...

tldr be proactive and build it already. also commit to dedication of writing consistently since the destructive interference between time spent coding and creatively, constructively writing seems inescapable otherwise.

There should be a macro for the canonical entropy symbol (searching entropy won't match any elements of all blocks) as well as a "fun" /(or-and with colorful emoji) symbol.
Anyone have any ideas on what such an ideogram might look like?
@atengberg
atengberg / EPSgen.js
Last active May 3, 2024 10:05
Of all the eager settled promises.
/*
Always interesting when while working on a specific problem resolution,
coincidentally the circle gets squared. In this case, while building one thing,
it lead down the rabbit hole of async generators which surveyed everything from
https://www.dreamsongs.com/WorseIsBetter.html to https://okmij.org/ftp/Streams.html
and much, much more until it led back to an SO post that had a related SO post that
was quite literally almost the same thing I had originally set out to build (!).
I should probably compile all the bookmarks for any potential shared future benefit,
but note this particular generator function is almost *entirely* modeled on the work of Redu from:
@atengberg
atengberg / zx_for_redis-server_dev.js
Last active March 4, 2024 18:44
(Somewhat naive) Approach to using ZX for managing redis server during node project development
// Using zx to manage background redis server (for development purposes mostly, and doesn't require sudo (except prior to, when disabling redis-server autoboot initially)).
// ( cli user input loop logic via zx question likely suggests its own reusable component TBD; also something similar for zx error handling).
// notice while redis-server cmd is used to start, to cleanly stop redis-cli shutdown is used. Avoids manipulating systemctl (as I saw on several guides) which when doing so tended to spontaneousily crash my system).
// in reverse order for readible coherence, all relative directories flattened for simplicity.
// assume npm esm project... with a script defined:
// npm script: "redis-server": "node index.js" (see below)
@atengberg
atengberg / bounty-task-checklist.md
Last active February 16, 2023 01:26
bnt-2 invoice canister completed bounty-task checklist

BNT-2 - Invoice Bounty Task Check Sheet

This is a list of all the tasks specified as part of the bounty to be completed before submission for approval.

They can be originally found at BNT-2: Invoice Canister #2.

This was created to make it easier to know what needed to be done as to verify everything has been completed.


@atengberg
atengberg / comment-example.mo
Last active February 14, 2023 21:45
comment level verbosity
Example A (**verbose in-method-body comments**)
public shared ({ caller }) func verify_invoice(
{ id } : Types.VerifyInvoiceArgs,
) : async Types.VerifyInvoiceResult {
switch (getInvoiceIfAuthorized(invoices.get(id), caller, #Verify)) {
// Caller is not authorized or invoice not found.
case (#err err) return #err(err);
// Caller is creator or on invoice's verify permissions list.
case (#ok invoice) {
@atengberg
atengberg / MockTokenLedgerCanisters.mo
Last active February 14, 2023 21:22
icp or icrc1 ledger canister that can be used to mock icp or icrc1 token-ledger canisters
You can drop the ICP.MockLedger if you want to skip importing the Aviate Labs libraries and just use it for ICRC1.
MockTokenLedgerCanisters.mo...
```
import Array "mo:base/Array";
import Blob "mo:base/Blob";
import Buffer "mo:base/Buffer";
import Debug "mo:base/Debug";
import Error "mo:base/Error";
import HashMap "mo:base/HashMap";
@atengberg
atengberg / using zx for dfx
Last active January 25, 2023 19:14
an example of using zx to deploy an icrc1 ledger with a esm utility function and run dfx nns install after checking if networks config is correct
uses zx as ilocal project dependency; zx can also
be used by including its shebang at the beginning
of the mjs using it--in that case can be run by
> chmod +x file.mjs
> zx file.mjs
⸎⸖------------------------------------------------------------------------⸖⸎
./zx-scripts/generate_icrc1_deployment_literal.mjs:
<start of file>
@atengberg
atengberg / new_gist_file_0
Last active February 14, 2023 22:04
what is oo
What is objected orientated programming?
"Object oriented programming is a technique of writing code that encapsulates complexity by enumerating data structures with an intrinsic implementation so that they can generally interface."