Skip to content

Instantly share code, notes, and snippets.

View portothree's full-sized avatar
♟️

Gus Porto portothree

♟️
View GitHub Profile
function check_pt_bi_nif(number, check) {
check = parseInt(check);
number = [...number].reverse();
let value = 0;
number.forEach(function(k, v) {
value += (k + 2) * v;
});
function deg2rad(degrees) {
return degrees * (Math.PI / 180);
}
function rad2deg(radians) {
return radians * (180 / Math.PI);
}
/**
* @param {Array} [directions] - array of directions in degrees
@portothree
portothree / pull-develop.sh
Created September 16, 2020 16:06
pull-develop.sh <branch-name>
#!/bin/bash
git checkout develop
git pull
git checkout feature/$1
git merge develop
git push
#! /bin/sh
sxhkd &
xrandr --output "HDMI-A-0" --primary --mode 1920x1080 --rotate normal --output eDP --mode 1920x1080 --rotate normal --right-of "HDMI-A-0"
bspc monitor "HDMI-A-0" -d I II III IV V VI VII VIII IX
bspc monitor eDP -d X
bspc config border-width 2
@portothree
portothree / _mixins.scss
Created August 13, 2020 10:06
Breakpoint mixins
// breakpoints
// small mobile portrait
@mixin viewport-3 {
@media (min-width: 330px) {
@content;
}
}
// mobile ladscape
@portothree
portothree / single.component.spec.ts
Created July 6, 2020 16:57
@testing-library/angular snippets
import { render, screen, fireEvent } from '@testing-library/angular';
import { SingleComponent } from './single.component';
test('renders the component', async () => {
await render(SingleComponent);
});
I am fearless in my heart
They will always see that in my eyes
I am the passion, I am the warfare
I will never stop
Always constant, accurate, intense...
- Steve Vai
@portothree
portothree / data.json
Last active January 30, 2020 20:12
data for wooza test
{
"users": [
{
"id": 1,
"full_name": "Leonardo Ferreira",
"role": "Agricultor",
"photo": "https://images.generated.photos/nLDaKuZTAyRzaZR0bjIp1Fxa0B8YpJxyIVOMp2fHINs/rs:fit:512:512/Z3M6Ly9nZW5lcmF0/ZWQtcGhvdG9zLzA1/MTEzNzkuanBn.jpg"
},
{
"id": 2,
const array = [{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825},{"usd":0.21,"metal":3.825}];
const result = Math.min.apply(Math,array.map(function(o){return o.usd;}))
console.log(`Min usd: ${result}`);
sudo wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlp1s0
sudo dhclient wlp1s0
ip addr show wlp1s0
sudo dhclient wlp1s0 -r