Skip to content

Instantly share code, notes, and snippets.

View samuelastech's full-sized avatar
🎯
Focusing

Samuel A. Souza samuelastech

🎯
Focusing
View GitHub Profile
@samuelastech
samuelastech / pipenv_cheat_sheet.md
Created October 20, 2022 14:54 — forked from bradtraversy/pipenv_cheat_sheet.md
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell
@samuelastech
samuelastech / opencv_from_base64.py
Created October 7, 2022 19:09 — forked from HoweChen/opencv_from_base64.py
[opencv_from_base64]read image from opencv with base64 encoding #OpenCV
import cv2
import numpy as np
import base64
image = "" # raw data with base64 encoding
decoded_data = base64.b64decode(image)
np_data = np.fromstring(decoded_data,np.uint8)
img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
cv2.imshow("test", img)
cv2.waitKey(0)
@samuelastech
samuelastech / renameKeys.js
Created October 5, 2022 16:33
A function that catches a JavaScript object and rename the keys you want
const obj = {
name: 'Player',
team: 'Barcelona',
role: 'Raphinha'
}
/**
* Rename the a key of an object
* @param {Object} object with the keys to be renamed
* @param {Object} keys an array [oldkey, newkey], you can send as many pairs as you wish
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current'
}
}
],
@samuelastech
samuelastech / jest-package.json
Last active October 3, 2022 19:19
Jest and supertest setup
{
"scripts": {
"test": "jest --watch --verbose",
"test-coverage": "jest --coverage"
},
"devDependencies": {
"@faker-js/faker": "...",
"factory-girl": "...",
"faker": "...",
@samuelastech
samuelastech / .eslintrc.json
Last active October 3, 2022 18:33
ESLint setup
{
"env": {
"es2021": true,
"node": true,
"jest": true
},
"extends": "standard-with-typescript",
"overrides": [
],
"parserOptions": {
@samuelastech
samuelastech / ts-node-dev.json
Last active October 3, 2022 18:21
Typescript setup
{
"scripts": {
"dev": "ts-node-dev -r tsconfig-paths/register --respawn --transpile-only --ignore-watch node_modules --no-notify bin/www.ts"
}
}
@samuelastech
samuelastech / git-automated-push.sh
Created September 5, 2022 14:48
Automated git add, commit, and push
#!/bin/bash
FINISHED=false
while ! $FINISHED; do
echo 'Enter the files you want to commit: '
read FILES
if [ $FILES == '.' ]; then
git add $FILES
FINISHED=true
else

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@samuelastech
samuelastech / includingHTML.html
Created April 28, 2022 13:38
Using jQuery 'load' function we can break our HTML files into smaller parts
<script src="./js/jquery-3.6.0.js"></script>
<script>
$(function () {
const includes = $('[data-include]')
$.each(includes, function(){
let file = 'includes/' + $(this).data('include') + '.html'
$(this).load(file)
})
})