Skip to content

Instantly share code, notes, and snippets.

View juniovitorino's full-sized avatar
🏠
Working from home

Junio Vitorino juniovitorino

🏠
Working from home
View GitHub Profile
@juniovitorino
juniovitorino / ievm.zsh
Last active December 18, 2015 03:59
ZSH Function to download and install Windows and Internet Explorer VirtualBox VM from xdissent ievms project.
function ievm {
curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="$1" bash
}
@juniovitorino
juniovitorino / remove-extension.conf
Created June 28, 2013 13:52
Remove file extension from urls's
# http://www.niallflynn.com/seo-news/remove-file-extension-from-urls/
<IfModule mod_rewrite.c>
AddType text/x-component .htc
RewriteEngine On
RewriteBase /
# remove .php; use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
# remove index
@juniovitorino
juniovitorino / toEM.sass
Last active December 19, 2015 04:58
SASS Function to convert PX in EM
$em-base: 16px !default;
@function toEM($px) {
@return $px / $em-base * 1em;
}
web: /usr/local/sbin/nginx -p `pwd`/tmp/nginx/ -c ../../nginx.conf
fastcgi: /usr/local/sbin/php-fpm
db: /usr/local/bin/mysqld
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Disables the home button.</string>
<key>PayloadDisplayName</key>
@juniovitorino
juniovitorino / ncenter
Created November 12, 2013 13:37
Load/Unload OS X Notification Center
# Notification Center
alias ncstop="launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist"
alias ncstart="launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist"
@juniovitorino
juniovitorino / backup.sh
Created November 20, 2014 20:50
CLONE CLIENTES PARTITION AND SAVE COMPRESSED IMAGE IN AN EXTERNAL HARD DISK (USB)
#!/bin/bash
# AUTHOR: JUNIO VITORINO | jgvitorino@gmail.com
# DESCRIPTION: DAILY CLONE CLIENTES PARTITION AND SAVE COMPRESSED IMAGE IN AN EXTERNAL HARD DISK (USB)
# DATE: NOVEMBER 20, 2014
rm -rf /backup/*.gz
now=$(date +"%m_%d_%Y")
dd if=/dev/sda5 conv=sync,noerror bs=1K | gzip -c > "/backup/dd_image_clientes_$now.gz"
<?php
// DATABASE
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASSWORD', getenv('DB_PASS'));
define('DB_HOST', getenv('DB_HOST'));
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8_general_ci');
<?php
// DATABASE
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASSWORD', getenv('DB_PASS'));
define('DB_HOST', getenv('DB_HOST'));
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8_general_ci');
function excerpt_count_js(){
if ('page' != get_post_type()) {
echo '<script>jQuery(document).ready(function(){
jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:12px;right:34px;color:#666;\"><small>Excerpt length: </small><span id=\"excerpt_counter\"></span><span style=\"font-weight:bold; padding-left:7px;\">/ 500</span><small><span style=\"font-weight:bold; padding-left:7px;\">character(s).</span></small></div>");
jQuery("span#excerpt_counter").text(jQuery("#excerpt").val().length);
jQuery("#excerpt").keyup( function() {
if(jQuery(this).val().length > 500){
jQuery(this).val(jQuery(this).val().substr(0, 500));