Skip to content

Instantly share code, notes, and snippets.

View DawTaylor's full-sized avatar
👀

Adalberto Taylor DawTaylor

👀
  • Águas de Lindóia - SP - Brazil
  • 19:29 (UTC -03:00)
View GitHub Profile
@DawTaylor
DawTaylor / end.gcode
Created September 3, 2021 12:38
CR-200B start and end gcodes
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positioning
G1 X0 Y0;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
const [_,__,...args] = process.argv
const isEven = (_, i) => (i % 2 === 0)
const isOdd = (_, i) => (i % 2 !== 0)
const parsedArgs = args.map(arg => parseInt(arg))
const scores = parsedArgs.filter(isEven)
const weights = parsedArgs.filter(isOdd)
{
"extends": ["airbnb", "prettier"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"impliedStrict": true,
"classes": true
}
const express = require('express')
const axios = require('axios')
const app = express()
const url = process.env['BASE_URL']
app.get('/*', (req, res) => {
axios.get(`${url}${req.url}`, {
headers: {
'Accept': 'application/json'
@DawTaylor
DawTaylor / spread.js
Created January 8, 2018 13:17
Spead operator uses
// This is our User
const User = {
name: 'John Doe',
email: '[email protected]',
status: 'enabled'
}
// NewUser is now a clone of User
const NewUser = {
...User
@DawTaylor
DawTaylor / no-root-port-80-macos.md
Created November 17, 2017 11:19
Redirect traffic from port 80 to any port on Mac OS

Redirect traffic from port 80/443 to any port on Mac OS

This allows you to access your application on port 80 without root access on Mac OS.

Non-SSL traffic

  1. First, define wich ports you want to redirect to
NON_SSL_PORT=8080
@DawTaylor
DawTaylor / README.md
Last active December 17, 2020 14:28
Mapeamento de múltiplos arquivos de rotas no Laravel 5.5

Separando arquivos de rotas no Laravel 5.5

Conforme a sua aplicação cresce é provavel que seu arquivo de rodas fique muito grande. Separar esses arquivos em arquivos menores ajuda na organização e manutenção posterior do código.

Neste exemplo separamos os arquivos de rotas da api em vários arquivos agrupados dentro do diretório routes/api.

Para fazer com que o Laravel reconheça essas rotas é preciso registrar cada arquivo de rota dentro do RouteServiceProvider.php usando o código abaixo.

Route::prefix('api')
@DawTaylor
DawTaylor / factorial.js
Created October 7, 2017 19:45
Simple JS factorial implementation
const factorial = n => (n <= 1) ? 1 : n * factorial(n - 1);
let n = process.argv[2];
console.log(`Factorial of ${n} = ${factorial(n)}`);
@DawTaylor
DawTaylor / docker-compose.yml
Last active September 18, 2017 13:37
Docker compose simples para subir um magento
version: '3'
services:
web:
container_name: magento2
image: alexcheng/magento2
ports:
- "80:80"
mysql:
container_name: mysql
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-app
spec:
rules:
- host: example.com
http:
paths:
- path: /