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
<?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>
web: /usr/local/sbin/nginx -p `pwd`/tmp/nginx/ -c ../../nginx.conf
fastcgi: /usr/local/sbin/php-fpm
db: /usr/local/bin/mysqld
@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;
}
@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 / 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 / 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);
@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 / 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 / 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 / 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"];