Skip to content

Instantly share code, notes, and snippets.

View rhcarlosweb's full-sized avatar
🖖

Rhuan Carlos rhcarlosweb

🖖
View GitHub Profile
## pine64
sudo curl -L "https://github.com/ubiquiti/docker-compose-aarch64/releases/download/1.22.0/docker-compose-Linux-aarch64" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
## raspberry pi
# Install required packages
apt update
apt install -y python python-pip python-setuptools build-essential python-dev libffi-dev
# Install Docker Compose from pip
pip install docker-compose
@jaredatch
jaredatch / functions.php
Last active July 3, 2023 23:10
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@edirpedro
edirpedro / estados-brasil.php
Last active April 22, 2024 12:12
Estados do Brasil (Lista, Array)
// Lista
AC, Acre
AL, Alagoas
AP, Amapá
AM, Amazonas
BA, Bahia
CE, Ceará
DF, Distrito Federal
ES, Espirito Santo
@isaacrankin
isaacrankin / resize-image.php
Created February 17, 2016 03:15
WordPress Image resize on the fly
/**
* Resize image on the fly
*
* @param int $attachment_id Attachment ID
* @param int $width Width
* @param int $height Height
* @param boolean $crop Crop or not
*
* @return string|bool URL of resized image, original file if error
*/
@gusribeiro
gusribeiro / iin_card
Last active April 26, 2024 21:10
Regex para identificar bandeiras do cartão de crédito
Amex: ^3[47][0-9]{13}$
Aura: /^((?!504175))^((?!5067))(^50[0-9])/
Banese Card: '^636117'
Cabal: '(60420[1-9]|6042[1-9][0-9]|6043[0-9]{2}|604400)'
Diners: '(36[0-8][0-9]{3}|369[0-8][0-9]{2}|3699[0-8][0-9]|36999[0-9])
Discover: /^6(?:011|5[0-9]{2})[0-9]{12}/
Elo: /^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^50(4175|6699|67[0-6][0-9]|677[0-8]|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9])|^627780|^63(6297|6368|6369)|^65(0(0(3([1-3]|[5-9])|4([0-9])|5[0-1])|4(0[5-9]|[1-3][0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8]|4[1-9]|[5-8][0-9]|9[0-8])|7(0[0-9]|1[0-8]|2[0-7])|9(0[1-9]|[1-6][0-9]|7[0-8]))|16(5[2-9]|[6-7][0-9])|50(0[0-9]|1[0-9]|2[1-9]|[3-4][0-9]|5[0-8]))/
Fort Brasil: '^628167'
GrandCard: '^605032'
Hipercard: ^606282|^3841(?:[0|4|6]{1})0
@rdeavila
rdeavila / git-update-fork.sh
Last active February 19, 2024 16:02
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
@bivald
bivald / photoshop-to-css.sass
Created March 7, 2014 09:02
Sass mixin to convert photoshop line-height to CSS, photoshop letter-spacing to CSS
/* Reset rem to 10-based instead of default browser 16 */
html {
font-size: 62.5%;
}
/*
Photoshop does not apply line height to the first row, which CSS does. This creates all kinds of havock.
To calculate the correct offset for the first line we need the font-size and the lineheight, i.e:
@include line-height(22,30);
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active April 18, 2024 01:00
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 "your_email@example.com". Th
@kucrut
kucrut / nav-menu-item-custom-fields.php
Created September 29, 2012 15:39 — forked from westonruter/nav-menu-item-custom-fields.php
Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
<?php
/**
* Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
* @author Weston Ruter (@westonruter), X-Team
*/
add_action( 'init', array( 'XTeam_Nav_Menu_Item_Custom_Fields', 'setup' ) );
class XTeam_Nav_Menu_Item_Custom_Fields {
static $options = array(