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
#!/bin/bash
OUTPUT_PATH='~/app/webroot/files/depoimentos/flv'
MOVIES_PATH='~/app/webroot/files/depoimentos/videos'
ORIGINAL_PATH='~/app/webroot/files/depoimentos/videos_originais'
cd $MOVIES_PATH
for filename in *.*
do
if [ -e $filename ]; then
@juniovitorino
juniovitorino / gist:4252111
Last active October 13, 2015 20:37
CSS: WordPress default style.css
/*
Theme Name:
Theme URI: http://
Description:
Author:
Author URI: http://
Version:
Tags:
License:
@juniovitorino
juniovitorino / gist:4642403
Last active December 11, 2015 18:38
Rails: MySQL database connection in Rails 3
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: your_database_name
pool: 5
username: your_username
password: your_password
socket: /tmp/mysql.sock
@juniovitorino
juniovitorino / gist:4642417
Last active December 11, 2015 18:38
Rails: SQLite database connection in Rails 3
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
@juniovitorino
juniovitorino / gist:4642436
Last active December 11, 2015 18:38
Rails: Postgres database connection in Rails 3
development:
adapter: postgresql
encoding: unicode
database: your_database_name
pool: 5
username: your_username
password: your_password
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
@juniovitorino
juniovitorino / gist:4677039
Created January 30, 2013 21:12
Kiwi Test sample
#import "Kiwi.h"
#import "User.h"
SPEC_BEGIN(User)
describe(@"User", ^{
context(@"User creation", ^{
it(@"it should have a name", ^{
User *user = [[User alloc] init];
[user setName: @"Junio Vitorino"];
@juniovitorino
juniovitorino / invoke_class_method.m
Last active December 12, 2015 05:28
Invoking class methods
@interface Person : NSObject
+(BOOL) walking;
@end
@interface Philip : Person
+(BOOL) walking;
@end
@implementation Philip
@juniovitorino
juniovitorino / Guardfile
Last active December 17, 2015 03:08
Guard simple boilerplate
# More info at https://github.com/guard/guard#readme
guard 'sass', :input => 'sass', :output => 'css', :style => :compressed, :no => :cache
guard :livereload do
watch %r{.+\.(php|html|css|js)$}
end
guard :concat, type: 'js', files: %w(), input_dir: 'js', output: 'js/app'
@juniovitorino
juniovitorino / gist:5587839
Created May 15, 2013 22:11
Hotlink Protection
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?youralloweddomain.com [NC]
RewriteRule \.(jpeg|jpg|gif|pdf)$ - [NC,F,L]
</IfModule>
@juniovitorino
juniovitorino / xss_sanitization.php
Last active December 17, 2015 13:49
WordPress Recursive XSS Sanitization
// XSS HTTP Treatment
add_filter('init', 'xssTreatment');
function xssTreatment() {
foreach(array($_GET, $_POST, $_REQUEST) as $httpConst) XSSSanitization( $httpConst );
}
function XSSSanitization(&$param) {
if(!is_array( $param ) && is_string( $param ) ) $param = filter_var($param, FILTER_SANITIZE_STRING);