Skip to content

Instantly share code, notes, and snippets.

View tgmarinho's full-sized avatar
💻
read my blog: tgmarinho.com

Thiago Marinho tgmarinho

💻
read my blog: tgmarinho.com
View GitHub Profile
@tgmarinho
tgmarinho / cc.md
Created April 19, 2024 20:48 — forked from noghartt/cc.md
Resources to learn more about Computer Science and related stuffs

VIVA LA MAIN

A proposta é manter apenas uma branch: main.

Dev abre PR, e o CI roda testes, verifica se build passa, é feito code review e o merge é feito para main.

Todo código novo na main vai gerar uma nova CI e CD, uma release para ambiente de staging, onde é feito o QA pelas partes interessadas (Dev, QA, Product).

O controle do que pode ser exibido por ambiente é feito por feature flags, basicamente um if no código que verifica se no ambiente X (staging | production) a feature pode ser ativada ou desativada.

@tgmarinho
tgmarinho / production-api-and-cronjobs.yml
Created April 10, 2024 13:56
main branch - .github/actions
name: Deploy COMPANY API & Cronjobs API Production
concurrency:
group: production-api-${{ github.ref }}
on:
push:
branches:
- main
@tgmarinho
tgmarinho / .tsx
Created February 16, 2024 17:44 — forked from dutradotdev/.tsx
BlurContainer in React Native
import React from 'react';
import WebView from 'react-native-webview';
export type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`;
export interface BlurContainerProps {
backgroundColor: RGBA;
blurRadius: number;
}
"use client";
import 'core-js/stable';
import { motion } from "framer-motion";
import { CalendarDays, CheckIcon, CreditCard, MapPin } from "lucide-react";
import Link from "next/link";
import Button from "../Button";
import React from "react";
import QRCode from "qrcode.react";
import { useOpenPix } from '@openpix/react';
@tgmarinho
tgmarinho / adjascent_state.js
Last active September 16, 2023 00:39
adjascent_state.js
const estados = [
{ name: 'Alabama', abbreviation: 'AL', id: 1 },
{ name: 'Alaska', abbreviation: 'AK', id: 2 },
{ name: 'American Samoa', abbreviation: 'AS', id: 3 },
{ name: 'Arizona', abbreviation: 'AZ', id: 4 },
{ name: 'Arkansas', abbreviation: 'AR', id: 5 },
{ name: 'California', abbreviation: 'CA', id: 6 },
{ name: 'Colorado', abbreviation: 'CO', id: 7 },
{ name: 'Connecticut', abbreviation: 'CT', id: 8 },
{ name: 'Delaware', abbreviation: 'DE', id: 9 },
-- SHIFT 1
-- Inserir o turno (shift)
INSERT INTO shifts (facility_id, certification_id, recurring_type_id, start_date, end_date, is_active, shift_timecode_id, shift_incentive_hourly, shift_bonus, shift_assignment_type, created_by, first_occurrence_starts, first_occurrence_ends, created_at, updated_at, deleted_at, shift_type, state_id)
VALUES
(213, 3, 1, '2023-08-01 14:00:00-04', '2023-08-01 22:00:00-04', true, 6, NULL, 0.0, 1, 1612, '2023-07-30 06:00:00-04', '2023-07-30 06:00:00-04', '2023-07-30 06:00:00-04','2023-07-30 06:00:00-04', NULL, 1, 51)
RETURNING id;
-- Inserir a instância de turno (shift_instance)
module.exports = {
up: function (queryInterface, Sequelize) {
return Promise.all([
queryInterface.addColumn('User', 'name', {
type: Sequelize.STRING
}),
queryInterface.addColumn('User', 'nickname', {
type: Sequelize.STRING,
})
]);
@tgmarinho
tgmarinho / settings.json
Last active February 7, 2024 12:32
vscode settings
{
"emmet.syntaxProfiles": {
"javascript": "jsx"
},
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 16,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [
80,
@tgmarinho
tgmarinho / useDeviceDetect.ts
Created May 11, 2023 14:23
react hook useDeviceDetect
const getMobileDetect = (userAgent: string) => {
const isAndroid = (): boolean => Boolean(userAgent.match(/Android/i))
const isIos = (): boolean => Boolean(userAgent.match(/iPhone|iPad|iPod/i))
const isOpera = (): boolean => Boolean(userAgent.match(/Opera Mini/i))
const isWindows = (): boolean => Boolean(userAgent.match(/IEMobile/i))
const isSSR = (): boolean => Boolean(userAgent.match(/SSR/i))
const isMobile = (): boolean => Boolean(isAndroid() || isIos() || isOpera() || isWindows())
const isDesktop = (): boolean => Boolean(!isMobile() && !isSSR())
return {