Skip to content

Instantly share code, notes, and snippets.

View gabrielzevedo's full-sized avatar

Gabriel Azevedo gabrielzevedo

View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@jaydson
jaydson / gist:1780598
Created February 9, 2012 15:11
How to detect a click event on a cross domain iframe
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
@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 {
@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
@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)){
@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() {
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@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)
@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";
@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',];