Skip to content

Instantly share code, notes, and snippets.

View nunomazer's full-sized avatar
🎯
Coding ... allways

Ademir Mazer Jr [ Nuno ] nunomazer

🎯
Coding ... allways
View GitHub Profile
@ajaxray
ajaxray / CreateUser.php
Last active June 11, 2023 15:14
A Laravel Artisan command for creating user with name, email and password
<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Validator;
class CreateUser extends Command
{
@VictorTaelin
VictorTaelin / gpt4_abbreviations.md
Last active June 18, 2024 15:03
Notes on the GPT-4 abbreviations tweet

Notes on this tweet.

  • The screenshots were taken on different sessions.

  • The entire sessions are included on the screenshots.

  • I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.

  • The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.

@bjornpagen
bjornpagen / ga4-utm-parameters-event.js
Created January 31, 2023 03:20
A JavaScript code snippet for logging UTM parameters as a GA4 event, only including parameters that are set in the URL and omitting any parameters that are not set.
// Get the UTM parameters from the URL
var search = window.location.search;
var params = new URLSearchParams(search);
// Keep track of if an event has already been logged
var eventLogged = false;
// Loop through each UTM parameter
for (var [key, value] of params.entries()) {
// Check if the parameter is "utm_source", "utm_medium", "utm_campaign", "utm_term", or "utm_content"
@nunomazer
nunomazer / gitcom.md
Created June 7, 2021 20:52 — forked from jednano/gitcom.md
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

git init
//Pete's tracker
function petesTracker(action,category,label) {
window.uetq = window.uetq || [];
window.gtag = window.gtag || [];
window.fbq = window.fbq || [];
window._paq = window._paq || [];
if (typeof gtag != "undefined") {
gtag('event', action, {event_category: category, event_label: label});
@dillansimmons
dillansimmons / passUTM.js
Last active June 2, 2024 14:32
Pass current UTMS to in page links Javascript
// JS for grabbing utm params and parsing into url
var getRefQueryParam = function() {
var temp = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function() {
var decode = function(s) {
return decodeURIComponent(s.split("+").join(" "));
};
temp[decode(arguments[1])] = decode(arguments[2]);
});
return temp;
@mpociot
mpociot / TelegramInlineQueryDriver.php
Created January 2, 2017 23:29
BotMan messaging driver that adds support for Telegram inline queries.
<?php
namespace Mpociot\BotMan\Drivers;
use Mpociot\BotMan\Answer;
use Mpociot\BotMan\Message;
use Mpociot\BotMan\Question;
use Illuminate\Support\Collection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@mikemimik
mikemimik / main.dart
Last active August 3, 2022 04:21
Flutter: Custom theme data
import 'package:flutter/material.dart';
import 'theme.dart' as Theme;
void main() {
runApp(
new MaterialApp(
title: 'CompanyApp',
color: Theme.CompanyColors.blue[500],
theme: Theme.CompanyThemeData,
home: new Scaffold(
@fer-ri
fer-ri / directives.php
Created December 8, 2016 10:16
Laravel Blade Directive To Set Active Menu Class
<?php
Blade::directive('active', function ($expression) {
return "<?php echo active_url($expression); ?>";
});
@davidalves1
davidalves1 / formatar_cnpj_cpf.md
Last active May 17, 2024 11:26
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

function formatCnpjCpf($value)
{
  $CPF_LENGTH = 11;
  $cnpj_cpf = preg_replace("/\D/", '', $value);
  
  if (strlen($cnpj_cpf) === $CPF_LENGTH) {
    return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
  }