Skip to content

Instantly share code, notes, and snippets.

View shadowcodex's full-sized avatar
🐍
Pythoning

Shannon Duncan shadowcodex

🐍
Pythoning
View GitHub Profile
@shadowcodex
shadowcodex / Readme.md
Last active March 4, 2024 21:07
How I wrangled my Todos...

As an person in general I have to keep track of a lot of todo's. I've used everything under the sun to track them. Todoist, Wunderlist, Microsoft Todos, trello, etc...

But nothing was ever as good as a simple piece of paper. Just write down stuff and freeform it. Until I ran across todo.txt.

Its:

  1. Simple
  2. Easy
  3. Programmable

See: http://todotxt.org/

@shadowcodex
shadowcodex / asdf
Last active May 28, 2021 01:26
Bildr API Calls
asdf
<script src="https://gist.github.com/shadowcodex/f16168ad75b257760233c60517f9a378.js"></script>
@shadowcodex
shadowcodex / keybase.md
Created January 8, 2020 16:13
keybase.md

Keybase proof

I hereby claim:

  • I am shadowcodex on github.
  • I am shadowcodex (https://keybase.io/shadowcodex) on keybase.
  • I have a public key ASBAto6a1XocuLKxp9p9tk7i8wG3t5EIQRcDS1gnlm41igo

To claim this, I am signing this object:

@shadowcodex
shadowcodex / sleep.js
Created March 5, 2019 19:44
sleep function using async/await
const sleep = (time) => {
return new Promise(resolve => {
setTimeout(resolve, time);
});
}
await sleep(1000);
@shadowcodex
shadowcodex / fix-web3.js
Last active December 7, 2018 16:17
Fix Web3 for timestamp overflow.
const fs = require("fs");
const path = "node_modules/web3-core-helpers/src/formatters.js";
if (fs.existsSync(path)) {
fs.readFile(path, "utf8", (err, data) => {
if (err) {
return console.error(err);
}
const result = data.replace(
/block\.timestamp \= utils\.hexToNumber\(/gm,
"block.timestamp = utils.hexToNumberString(",
@shadowcodex
shadowcodex / pritority-queue.js
Created December 5, 2018 20:26
Priority Queue in Javascript
class Queue {
constructor () {
this.priority = [];
this.regular = [];
}
enqueue(item, high = false) {
if(high) {
this.priority.unshift(item);
@shadowcodex
shadowcodex / fix-it-friday.md
Last active October 19, 2018 18:04
Fix Featherlite Cache

Featherlite Cache Issue for DEX

If you are seeing a blank screen it could be because of several reaons. However one of the hardest to debug is cache. Due to this the easiest way to see if cache is the culprit is to RENAME your cache folder (Do not delete, incase of lost data).

!!!! YOU SHOULD BACKUP ALL YOUR KEYS AND ACCOUNTS VIA ACCOUNT EXPORT BEFORE ATTEMPTING THIS !!!!

Ok, to redo your cache what you are going to want to do is locate your brave folder.

Windows: C:\Users\<user>\AppData\Roaming\brave

mkdir ~/.npm-global && npm config set prefix '~/.npm-global' && export PATH=~/.npm-global/bin:$PATH && source ~/.profile
npm config set prefix '~/.npm-global' && export PATH=~/.npm-global/bin:$PATH && source ~/.profile
@shadowcodex
shadowcodex / promise-all-resolve-all.js
Last active December 7, 2018 16:35
Prevent Promise.all fail fast
const resob = promise => {
return promise.then(result => ({ success: true, result })).catch(error => ({ success: false, error }))
}
const list = getListOfObjectsToHit();
let promises = list.map((value) => {
return resob(someAsyncProcess(value));
})
@shadowcodex
shadowcodex / prisma.js
Last active August 23, 2018 00:34
Handle Prisma subscription using prisma-binding v2.1.3
const { Prisma } = require("prisma-binding");
const prisma = new Prisma({
typeDefs: "./../generated/prisma.graphql",
endpoint: "http://localhost:4466",
});
const handleIty = async (iterator, callback) => {
while (true) {
await iterator