Skip to content

Instantly share code, notes, and snippets.

View gabrielzevedo's full-sized avatar

Gabriel Azevedo gabrielzevedo

View GitHub Profile
@ramirezsandin
ramirezsandin / useRouterParams.ts
Last active November 12, 2024 07:10
React hook to be used with Next.js, it uses useRouter internally and offers some helper functions to manipulate the url query params.
import { useRouter } from "next/router";
import { ParsedUrlQuery } from "querystring";
interface UseRouterParamsOptions {
method?: "push" | "replace";
shallow?: boolean;
}
const useRouterParams = (options?: UseRouterParamsOptions) => {
const { query, pathname, push, replace } = useRouter();
@howar31
howar31 / simple_scrollbar_hover_effect.css
Last active September 26, 2024 08:32
Neat and clean scrollbar with hover transition effect CSS
// Scrollbar with Hover Transition Effect
.container::-webkit-scrollbar {
width: 14px;
}
.container::-webkit-scrollbar-thumb {
background-clip: content-box;
border: 4px solid transparent;
border-radius: 7px;
box-shadow: inset 0 0 0 10px;
}
@sumanthkumarc
sumanthkumarc / eu_country_list.php
Last active June 3, 2023 22:13
EU (European country code and names list) in PHP array format
<?php
function get_eu_countries() {
$countries = [];
$countries['AT'] = ['name' => 'Austria',];
$countries['BE'] = ['name' => 'Belgium',];
$countries['BG'] = ['name' => 'Bulgaria',];
$countries['CY'] = ['name' => 'Cyprus',];
$countries['CZ'] = ['name' => 'Czech Republic',];
$countries['DE'] = ['name' => 'Germany',];
@rodrigojusto
rodrigojusto / capitalizenames.js
Created November 14, 2017 17:29
String Capitalize names
/** Prototipagem para capitalizar nomes próprios, levando em consideração que
não se capitalize as preposições, artigos e outros elementos que não sejam
Nomes proprios.
Ex: "rodrigo SOUZA juSTO".capitalizeNames() => "Rodrigo Souza Justo";
"osama bin ladeN".capitalizeNames() => "Osama bin Laden";
"PiErRo DELLA francesca".capitalizeNames() => "Pierro della Francesca";
"manfred von richthoffen".capitalizeNames() => "Manfred von Hichthoffen";
"JOÃO DA SILVA".capitalizeNames() => "João da Silva";
@mpneuried
mpneuried / Makefile
Last active August 22, 2024 10:36
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@raphaelchaib
raphaelchaib / script.js
Created August 6, 2015 00:45
VTEX: User login functions
/**
* isVTEXUserIdentified
* Verifica se o usuário VTEX está identificado (quando o sistema identificou
* o usuário pelo e-mail, mas ele ainda não digitou sua senha).
*
* @return BOOL
* TRUE - Se se estiver identificado ou autenticado
* FALSE - Se não estiver identificado
*/
function isVTEXUserIdentified() {
@DavidWells
DavidWells / clear-browser-cache.js
Last active February 24, 2021 09:55
Clear Browser cache. Run in your browsers javascript console
//Cache Buster
(function (){
  var rep = /.*\?.*/,
      links = document.getElementsByTagName('link'),
      scripts = document.getElementsByTagName('script'),
      process_scripts = false;
  for (var i=0;i<links.length;i++){
    var link = links[i],
        href = link.href;
    if(rep.test(href)){
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active October 23, 2024 11:31
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". Th
@jlengstorf
jlengstorf / wp-img-defaults.css
Created February 26, 2013 23:06
Default styling for WordPress image alignment and captions
/*
* Default WP Alignment Classes
*****************************************************************************/
.aligncenter,.alignleft,.alignright {
display: block;
padding: 0;
}
.aligncenter {