Skip to content

Instantly share code, notes, and snippets.

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

Thiago Marinho tgmarinho

💻
read my blog: tgmarinho.com
View GitHub Profile
@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
@tgmarinho
tgmarinho / getImageDimensions.js
Created October 5, 2021 15:01 — forked from rijkerd/getImageDimensions.js
Get dimension of an image object uploaded to firebase storage
const functions = require('firebase-functions');
const mkdirp = require('mkdirp-promise');
const admin = require('firebase-admin');
const { execFile } = require('child-process-promise');
const path = require('path');
const os = require('os');
const fs = require('fs');
admin.initializeApp();
@tgmarinho
tgmarinho / esm-package.md
Created September 22, 2021 10:33 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.