Skip to content

Instantly share code, notes, and snippets.

View lucatsf's full-sized avatar
🐺
Working from home

Lucas Torres lucatsf

🐺
Working from home
View GitHub Profile
@lucatsf
lucatsf / object-literal.php
Created January 11, 2022 18:07
How to create a literal object in PHP
<?php
$testArray = array(
(object)array("name" => "John", "age" => function () {
return 30;
}),
(object)array("name" => "Jane", "hobby" => function() {
return "painting";
})
);
@lucatsf
lucatsf / next.config.js
Created February 19, 2022 02:30
Error: Invalid src prop on `next/image`, hostname
const nextConfig = {
reactStrictMode: true,
}
module.exports = nextConfig
module.exports = {
images: {
domains: ['enter the domain of your image'],
formats: ['image/avif', 'image/webp'],
@lucatsf
lucatsf / result.js
Created March 16, 2022 17:53
Obtem retorno dinamico
//Manual
const resultsA = {
name: request.name.value,
age: request.age.value,
description: request.description.value,
price: request.price.value,
image: request.image.value,
}
//Dinamico
@lucatsf
lucatsf / mysql-docker.sh
Last active March 22, 2022 17:01 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > dump.sql
# Restore
cat dump.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@lucatsf
lucatsf / Dockerfile
Created March 23, 2022 13:16
Dockerfile to use mysql and node
version: '3'
services:
app:
build: .
command: yarn start
ports:
- '3000:3000'
volumes:
- .:/usr/app
@lucatsf
lucatsf / docker-compose.yml
Created March 23, 2022 13:16
docker-compose.yml
version: '3'
services:
app:
build: .
command: yarn start
ports:
- '3000:3000'
volumes:
- .:/usr/app
@lucatsf
lucatsf / dateFormate.js
Created March 29, 2022 16:17
Date Format PT-BR
const currentDate = new Date()
const formatDate = currentDate.toLocaleDateString(
'pt-BR',
{
day: '2-digit',
month: '2-digit',
year: 'numeric
}
)
@lucatsf
lucatsf / init.vim
Created April 7, 2022 16:30
My file neovim
call plug#begin()
Plug 'tomasr/molokai'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'sheerun/vim-polyglot'
Plug 'preservim/nerdtree'
Plug 'gko/vim-coloresque'
Plug 'cohama/lexima.vim'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'Xuyuanp/nerdtree-git-plugin'
@lucatsf
lucatsf / neural.py
Created April 17, 2022 22:07
example of an attempt to simulate a neuron
import numpy as np
entrada = np.array([
[0,0,1],
[1,1,1],
[1,0,1],
[0,1,1]
])
treinamento_resultado = np.array([[0,1,1,0]]).T
@lucatsf
lucatsf / chunk.js
Last active July 6, 2022 16:29
Create chunk in javascript
const chunkSize = 10;
for (let i = 0; i < dataLoad.length; i += chunkSize) {
const chunk = dataLoad.slice(i, i + chunkSize);
//exemplo a baixo
await request.post('/data-load', dataLoad)
}