Skip to content

Instantly share code, notes, and snippets.

View Scemist's full-sized avatar
🖌️
Painting Algorithms

Lucas Gonçalves S. Scemist

🖌️
Painting Algorithms
View GitHub Profile
@Scemist
Scemist / optimized-laravel.sh
Created May 7, 2024 11:26
How to Optimize Laravel App in Production
# Install dependences without the dev-only
npm install --omit=dev
composer install --no-dev -o
# Cache all the Laravel and Composer entities
php artisan route:cache
php artisan optimize
php artisan config:cache
composer dump-autoload --optimize
@Scemist
Scemist / table-sort.js
Last active September 11, 2023 18:29
JavaScript Modern Table Sort
const sortTableByColumn = (tableSelector, columnIndex) => {
const rows = document.querySelector(tableSelector)
.querySelectorAll(':scope > tbody > tr')
const getCellTextByPosition = row => {
const cell = row.querySelector(`:scope > *:nth-child(${columnIndex})`)
return cell == null ? '' : cell.innerText
}
@Scemist
Scemist / wsl-python-from-windows.ps1
Created July 27, 2023 11:34
Run WSL Python From Powershell
# If I already have Python on WSL, do I need to install it also on Windows to use in applications and Powershell? No:
function WslPython { wsl -e python3 }
New-Alias -Force -Name python -Value WslPython
# So I'm able to run Python in Windows by: python --version
name: appname
networks:
internal:
database:
services:
nginx:
build:
context: .
@Scemist
Scemist / css-std-printing-fontsize.md
Created January 11, 2023 14:13
CSS Standard Font Size for Printing in pt

pt is the best css unit for printing

  • p - 10pt
  • h1 - 16pt
  • h2 - 14pt
  • h3 - 12pt
  • h4 - 10pt
  • h5 - 8pt

In css

@Scemist
Scemist / nginx-config-php.conf
Created December 20, 2022 14:21
Nginx Config with FPM PHP
server {
listen 0.0.0.0:80;
index index.php index.html;
root /app/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
@Scemist
Scemist / php-inherance-keywords.md
Last active November 17, 2022 12:43
PHP Inherance Keywords: self, static, $this, ClassName
  • self
  • static
  • $this
  • ClassName

Difference Self and Parent

Child has foo() Parent has foo()
self::foo() YES YES Child foo() is executed
@Scemist
Scemist / request-loop.php
Last active November 17, 2022 12:49
PHP Cli Request Loop
<?php
# FileName should be "call", without extension. A calling in cli like "php call google.com"
enum Color: string
{
case Black = "\033[30m";
case Red = "\033[31m";
case Green = "\033[32m";
case Orange = "\033[33m";
@Scemist
Scemist / ajax.js
Last active October 6, 2022 17:06
Thirty Lines JavaScript Ajax Micro Framework
const Ajax = (parameters) => ({
to: parameters.to ?? null,
method: parameters.method ?? 'GET',
data: parameters.data ?? null,
callback: parameters.callback ?? null,
callbackData: parameters.callbackData ?? null,
send: function () {
const xhr = new XMLHttpRequest()
@Scemist
Scemist / javascript-dom-function.md
Last active October 27, 2022 19:33
Best JavasScript DOM functions

Add Element/HTML to Another Element

const container = document.querySelector('div')
const element = document.querySelector('p')

For node (element)