Skip to content

Instantly share code, notes, and snippets.

View ricardoriogo's full-sized avatar

Ricardo Riogo ricardoriogo

View GitHub Profile
@ricardoriogo
ricardoriogo / Gruntfile.js
Created January 4, 2014 16:37
Grunt base files.
module.exports = function(grunt) {
// Load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
@ricardoriogo
ricardoriogo / apsite.bat
Last active January 1, 2016 19:39
Cria um novo arquivo de configuração VHOST do Apache.
@ECHO OFF
SET appath=D:\xampp\apache\conf\sites\
SET /p dominio=Indique o dom¡nio ^*.dev a ser usado:
SET /p folder=Digite o caminho ROOT ou tecle ENTER para usar a pasta atual:
SET /p group=Digite o nome do grupo ao qual este dominio pertence:
IF "%folder%" == "" SET folder=%~dp0
IF NOT "%group%" == "" SET group=%group%\
@ricardoriogo
ricardoriogo / gsync.bat
Last active April 7, 2017 00:10
Script para abrir mais de uma instância do Google Drive (Windows) e sincronizar múltiplas contas. Lembrando que neste caso a pasta do Google Drive está na variável PATH do sistema.
@ECHO OFF
SET [email protected]
SET USERPROFILE=%~dp0%USERNAME%
MD "%USERPROFILE%\AppData\Roaming">nul
MD "%USERPROFILE%\AppData\Local\Application Data">nul
MD "%USERPROFILE%\Application Data">nul
MD "%USERPROFILE%\Local Settings\Application Data">nul
MD "%USERPROFILE%\My Documents">nul
MD "%USERPROFILE%\Documents">nul
START googledrivesync
############################################
## Fonts Support - for Apache Server ##
############################################
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
# webfont mime types
@ricardoriogo
ricardoriogo / web.config.xml
Created June 3, 2013 23:02
Exemplo de web.config rewrite
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Clean URL" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@ricardoriogo
ricardoriogo / gist:5674132
Last active December 17, 2015 21:19
Exemplo de configuração .sublime-project
{
"folders":
[
{
"path": "www"
}
],
"build_systems":
[
@ricardoriogo
ricardoriogo / gist:5667532
Last active December 17, 2015 20:29
Configuração exemplo vHost.
<VirtualHost *:80>
ServerName site.dev
DocumentRoot "D:\pasta_root"
</VirtualHost>
<Directory "D:\pasta_root">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
@ricardoriogo
ricardoriogo / httpd.conf
Created May 29, 2013 02:12
Como carregar configurações externas no apache. No exemplo abaixo carregará todos os arquivos com a extensão .conf (configurações virtual hosts) da pasta sites.
NameVirtualHost *:80
Include "conf/sites/*.conf"
@ricardoriogo
ricardoriogo / .htaccess
Created May 19, 2013 00:57
Meu .htaccess para uso com o CodeIgniter.
# Gzip compression
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
@ricardoriogo
ricardoriogo / slugify.js
Created February 13, 2013 01:59
Slugify: Remove acentos e caracteres não permitidos em urls, substitui espaços, underlines e caracteres não alfanuméricos por hífen.
String.prototype.slugify = function(){
return (this)
.replace(/[ÁÀÂÃÄ]/gi, 'a')
.replace(/[ÉÈÊË]/gi, 'e')
.replace(/[ÍÌÎÏ]/gi, 'i')
.replace(/[ÓÒÔÕÖ]/gi, 'o')
.replace(/[ÚÙÛÜ]/gi, 'u')
.replace(/[Ç]/gi, 'c')
.toLowerCase() // change everything to lowercase
.replace(/^\s+|\s+$/g, '') // trim leading and trailing spaces