Skip to content

Instantly share code, notes, and snippets.

View pferreirafabricio's full-sized avatar
🔥

Fabrício Pinto Ferreira pferreirafabricio

🔥
View GitHub Profile
<template>
<slot :env="env" />
</template>
<script setup lang="ts">
const env = computed(() =>
Object.entries(import.meta.env).reduce(
(acc, [key, value]) => ({
...acc,
[key]: value,
@raduchiriac
raduchiriac / prepare-commit-msg
Last active April 17, 2024 13:43
Hook: Prepend Jira ticket ID to the git commit message
#!/bin/bash
# Get the current branch name
current_branch=`git rev-parse --abbrev-ref HEAD`
# Search Jira ID in a pattern such a "feature/ABCD-123-my-feature"
id=$(echo $current_branch | sed -nE 's,[a-z]+/([A-Z]+-[0-9]+)-.+,\1,p')
# only prepare commit message if pattern matched and jiraId was found
if [[ ! -z $id ]]; then
@kasari
kasari / PostProcess-HeightFog.shader
Created November 3, 2019 09:20
[Unity] Post Process Height Fog
Shader "PostProcess/HeightFog"
{
Properties
{
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
_FogColor ("FogColor", Color) = (1,1,1,1)
_FogDensity ("FogDensity", Range(0,1)) = 0.2
_FogHeight ("FogHeight", float) = 5.0
}
SubShader
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ConnorGriffin
ConnorGriffin / GDrive.Upload.ps1
Last active February 9, 2024 22:10
GDrive Upload PowerShell Script
# Set the Google Auth parameters. Fill in your RefreshToken, ClientID, and ClientSecret
$params = @{
Uri = 'https://accounts.google.com/o/oauth2/token'
Body = @(
"refresh_token=$RefreshToken", # Replace $RefreshToken with your refresh token
"client_id=$ClientID", # Replace $ClientID with your client ID
"client_secret=$ClientSecret", # Replace $ClientSecret with your client secret
"grant_type=refresh_token"
) -join '&'
Method = 'Post'
@dsheiko
dsheiko / index.html
Last active October 27, 2023 19:59
Service-worker to prefetch remote images (with expiration) and respond with fallback one when image cannot be fetched
<!DOCTYPE html>
<html>
<head>
<title>Service-worker demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
if ( "serviceWorker" in navigator ) {
<?php
/**
* Classe Bhaskara, onde calculamos
* o conjunto solucão de uma equacão
* dados os valores dos coeficientes
* a, b e c.
*
* @author Samuel Simão
*
*/
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 26, 2024 15:48
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@rafael-neri
rafael-neri / validar_cpf.php
Last active April 12, 2024 17:40
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;
@chronon
chronon / ext.txt
Created February 18, 2017 15:38
List of docker-php-ext-install extension names
Possible values for ext-name:
bcmath
bz2
calendar
ctype
curl
dba
dom
enchant