Skip to content

Instantly share code, notes, and snippets.

View phsacramento's full-sized avatar

Paulo Henrique Sacramento phsacramento

View GitHub Profile
@phsacramento
phsacramento / VboxGuest
Created July 13, 2013 23:59
Install VirtualBox Guest Additions in Ubuntu Guest Terminal
#make it simple
mount /dev/cdrom /mnt # or any other mountpoint
cd /mnt
./VBoxLinuxAdditions.run
reboot
@phsacramento
phsacramento / SharedFolder.sh
Created July 14, 2013 01:02
VirtualBox Mount Shared Folder
sudo mount -t vboxsf -o uid=1000,gid=1000 $SharedFolderName $Local_to_Mount
# ###############
# SETUP LOCAL
# ###############
cd $LOCAL/$SITE
git init
git config color.branch auto
git config color.diff auto
git config color.interactive auto
git config color.status auto
##
# Ubuntu Server 12.04 64bits
# Automatiza o acesso SSH
# Oh my ZSH
# Shorewall
# PostFix (Enviar e-mails)
# Memcached
# Redis
# Varnish
##
@phsacramento
phsacramento / AngularJS URLS
Created January 29, 2014 14:14
AngularJS URLS
/**
* URLs
*/
window.URLS = {
// Exemplo
'/': {
templateUrl: '../../assets/home.html',
controller: 'HomeController',
title: 'Estúdio 12',
SET @antigaURL = 'http://siteantigo.com';
SET @novaURl = 'http://sitenovo.com';
# Atualiza URL do site nas opções
UPDATE wp_options SET option_value = replace(option_value, @antigaURL, @novaURL);
# Atualiza URL dos posts (e dentro deles)
UPDATE wp_posts SET guid = REPLACE (guid, @antigaURL, @novaURL);
UPDATE wp_posts SET post_content = REPLACE (post_content, @antigaURL, @novaURL);
UPDATE wp_posts SET post_excerpt = REPLACE (post_excerpt, @antigaURL, @novaURL);
##
# Ubuntu Server 12.04 64bits
# Automatiza o acesso SSH
# Oh my ZSH
# Shorewall
# PostFix (Enviar e-mails)
# Memcached
# Redis
# Varnish
##
@phsacramento
phsacramento / Function Value
Created June 4, 2014 17:41
Function Value
getPostCategory = function(post_id) {
$.getJSON( '/noticias/mobile/' + post_id + '/category', function( data ) {
var returnedObject = new Object();
returnedObject.name = data.name;
returnedObject.slug = data.slug;
console.log(returnedObject);
@phsacramento
phsacramento / cnpj.js
Last active March 4, 2023 00:23
Extensão para Jquery.Validation Brasil pt-BR Observação: Adicione no final do arquivo jquery.validation.js
jQuery.validator.addMethod("cnpj", function (cnpj, element) {
cnpj = jQuery.trim(cnpj);
// DEIXA APENAS OS NÚMEROS
cnpj = cnpj.replace('/', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('-', '');
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
date = date + 30.days
# OR SIMPLE
20.days.from_now