Skip to content

Instantly share code, notes, and snippets.

View tgmarinho's full-sized avatar
💻
read my blog: tgmarinhopro.com

Thiago Marinho tgmarinho

💻
read my blog: tgmarinhopro.com
View GitHub Profile
@tgmarinho
tgmarinho / destructuring.js
Created April 15, 2022 04:43 — forked from mikaelbr/destructuring.js
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@tgmarinho
tgmarinho / batchCursor.ts
Created March 25, 2022 22:37 — forked from sibelius/batchCursor.ts
Mongo cursor processing - let you select a strategy of how to process elements of a Cursor so you can iterate through all items
/*
* Usage
* let cursor = Test.find().sort({ name: 1 }).cursor();
const get = makeGen(cursor, 100);
let first100 = await get.next();
console.log(first100.value.length);
https://gist.github.com/lineus/3f7d826a21796129db968d6590c93faa
*/
export async function* batchCursor(c, n) {
const cursor = c;
@tgmarinho
tgmarinho / howto.md
Created February 12, 2022 16:40 — forked from electricg/howto.md
How to setup Gandi.net domain routing to Heroku

How to setup Gandi.net domain routing to Heroku

TODO: setup SSL.


This is a quick guide on how to setup domain and infinite subdomains, in a case where, for example, you may have one subdomain for each client.

Starting from this http://stackoverflow.com/a/39646701

@tgmarinho
tgmarinho / package.json
Created February 7, 2022 15:24 — forked from fersilva16/package.json
Run a TypeScript project using ESBuild and TSUP
{
"scripts": {
"build": "tsup",
"dev": "yarn build --onSuccess \"yarn start\"",
"dev:watch": "yarn dev --watch",
"start": "node dist/index.js",
},
"devDependencies": {
"tsup": "^5.11.13",
"typescript": "4.5.5"
function Trampoline(func) {
this.task = new Task(func);
}
Trampoline.prototype.step = function() {
if (!this.task) return;
this.task = this.task.cont();
if (this.task) this.task.nextStep = this.step.bind(this);
};
@tgmarinho
tgmarinho / ultimate-ut-cheat-sheet.md
Created December 23, 2021 03:55 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@tgmarinho
tgmarinho / docker-rm-images.md
Created December 18, 2021 15:21 — forked from bzz/docker-rm-images.md
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

References:

@tgmarinho
tgmarinho / erc20.json
Created October 20, 2021 00:50 — forked from nickgs/erc20.json
ERC20 ABI
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
pragma solidity ^0.4.19;
contract ERC20Basic {
string public constant name = "ERC20BasicName";
string public constant symbol = "BSC";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
@tgmarinho
tgmarinho / delete_git_submodule.md
Created October 14, 2021 22:01 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule