Skip to content

Instantly share code, notes, and snippets.

@thiagosouza
thiagosouza / tsconfig.json
Last active March 31, 2021 15:25
[Typescript] Typescript #typescript
{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"preserveConstEnums": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
@thiagosouza
thiagosouza / hosting.sh
Last active October 4, 2023 04:39
Firebase
firebase init hosting
firebase target:apply hosting www www
firebase target:apply hosting app app
firebase target:apply hosting backoffice backoffice
firebase target:apply hosting blog blog
mkdir public && cd public
mkdir www app backoffice blog
cp index www
@thiagosouza
thiagosouza / .gitignore
Last active June 2, 2020 19:42
[CSV File Reading Node.js] #csv #file #nodejs
node_modules
<!-- Youtube Iframe API -->
<script src="//www.youtube.com/iframe_api"></script>
<!-- Twitter API -->
<script src="//platform.twitter.com/widgets.js"></script>
<script>
collage.load('popcorn', {
twitter: [
@thiagosouza
thiagosouza / docker setup.sh
Last active April 17, 2023 17:56
[Docker Setup] docker setup on linux #docker #setup #linux
#https://docs.docker.com/install/linux/docker-ce/ubuntu/
#via Snap + Apt
sudo snap install docker
sudo apt install docker-compose
#permissions for docker compose
locate docker-compose
sudo chmod +x /usr/bin/docker-compose #or
sudo chmod +x /usr/local/bin/docker-compose
@thiagosouza
thiagosouza / .block
Created May 3, 2020 15:16 — forked from vasturiano/.block
tests / Timelines Chart
height: 700
scrolling: yes
@thiagosouza
thiagosouza / axios errors.ts
Created April 20, 2020 12:46
Node.js Requests #axios
//https://gist.github.com/fgilio/230ccd514e9381fafa51608fcf137253#file-axios-catch-error-js
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
@thiagosouza
thiagosouza / 0 setup test.sh
Last active May 7, 2022 05:14
[Unit tests in Typescript] #typescript #tests #tdd #jest #mocha #chai #jasmine
//https://medium.com/@RupaniChirag/writing-unit-tests-in-typescript-d4719b8a0a40
npm i -D chai mocha nyc ts-node typescript
npm i -D @types/chai @types/mocha
#Test Script
"scripts": {
"test": "mocha -r ts-node/register tests/**/*.test.ts",
"coverage": "nyc -r lcov -e .ts -x \"*.test.ts\" npm run test"
}
@thiagosouza
thiagosouza / here_documents.sh
Last active August 5, 2024 18:07
[Bash / Terminal commands] #terminal #shell #bash
#https://en.wikipedia.org/wiki/Here_document#Unix_shells
@thiagosouza
thiagosouza / setup.sh
Last active February 26, 2020 19:32
[Node.js] Node.js Setup #node #nodejs
#local hosting
npm i -g serve
npm i -g http-server
#environment vars
npm install -g env-cmd
cat <<EOF >./.env
# This is a comment
ENV1=THANKS
ENV2=FOR ALL