Skip to content

Instantly share code, notes, and snippets.

View felipepodesta's full-sized avatar
👨‍💻
Stairway To Heaven

Felipe Podestá felipepodesta

👨‍💻
Stairway To Heaven
View GitHub Profile
@felipepodesta
felipepodesta / sync.py
Created July 22, 2011 13:54 — forked from kennethreitz/sync.py
GitHub Syncer. Clones or Pulls all GitHub repos (including watched list).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
@felipepodesta
felipepodesta / gist:1216929
Created September 14, 2011 15:47
ruby version for the lazy:
module UADetect
RE_MOBILE = /mobile|iphone|ipod|blackberry|android|palm|windows\s+ce/i
RE_DESKTOP = /windows|linux|os\s+[x9]|solaris|bsd/i
RE_BOT = /spider|crawl|slurp|bot/i
# Anything that looks like a phone isn't a desktop.
# Anything that looks like a desktop probably is.
# Anything that looks like a bot should default to desktop.
def is_desktop?(user_agent)
(user_agent !~ RE_MOBILE && user_agent =~ RE_DESKTOP) || user_agent =~ RE_BOT
<?php
/* *******************************************
// Copyright 2010-2011, Anthony Hand
//
// File version date: August 22, 2011
//  Update:
//  - Updated DetectAndroidTablet() to fix a bug introduced in the last fix! The true/false returns were mixed up.
//
// File version date: August 16, 2011
/* *******************************************
// Copyright 2010-2011, Anthony Hand
//
// File version date: August 22, 2011
//  Update:
//  - Updated DetectAndroidTablet() to fix a bug introduced in the last fix! The true/false returns were mixed up.
//
// File version date: August 16, 2011
//  Update:
//  - Updated DetectAndroidTablet() to exclude Opera Mini, which was falsely reporting as running on a tablet device when on a phone.
@felipepodesta
felipepodesta / segments.php
Created March 5, 2012 17:03
php get url segments
function segments($index = NULL){
static $segments;
if ( NULL === $segments ){
$segments = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$segments = explode( '/', $segments );
$segments = array_filter( $segments );
$segments = array_values( $segments );
}
if ( NULL === $index ){
return '/' . implode( '/', $segments );
$('body.page-categoria-de-uso .view-grid-categorias-de-linha li a').each(function(){
var thiss = jQuery('.view-grid-categorias-de-linha a');
var thisslinlatual = thiss.attr('href');
var thissurlpattern = thisslinlatual.split('/');
var thissurlupfinal = thissurlpattern[thissurlpattern.length - 1];
var thissurldofinal = thisslinlatual + thissurlupfinal;
thiss.attr('href', thissurldofinal);
});
@felipepodesta
felipepodesta / BOOST Mobile Customization
Created April 9, 2012 20:25
BOOST Mobile Customization
### BOOST + Mobile Customization ###
# Put this in your .htaccess file (if you use Boost, put it before the Boost directives.)
# By default we assume that the accessing device is a desktop browser
RewriteRule .* - [E=device:www]
# If the user agent matches our definition of high end (mh) or low end (ml) device we set tour device variable
# overwrite the %{VAR:device} variable.
# These user agent expression should be adjusted according to your requirements.
@felipepodesta
felipepodesta / compress-tables.sh
Created April 18, 2012 16:31 — forked from deviantintegral/compress-tables.sh
Compress MySQL Tables
#!/usr/bin/env bash
# Compress MySQL tables on disk.
# Author: Andrew Berry, [email protected]
#
# Compress all tables in a MySQL InnoDB database using compression from the
# Barracuda table format. Tables have to already be in the Barracuda file
# format to actually compress tables, otherwise the table setting is ignored.
#
# innodb_file_per_table = 1 MUST be set in my.cnf for compression to work.
@felipepodesta
felipepodesta / strip_info.php
Created May 4, 2012 03:10 — forked from joshkoenig/strip_info.php
Strip drupal.org packaging data from core .info files
<?php
/**
* Quick script for stripping drupal packaging info.
*
* Run in the drupal root, or specify the root as an argument. E.g.:
*
* php strip_info.php path/to/drupal
*
*/
@felipepodesta
felipepodesta / PastryKit.js
Created May 11, 2012 14:40 — forked from aemkei/PastryKit.js
PastryKit - Apple iPhone Webdev Library
const PKSupportsTouches = ("createTouch" in document);
const PKStartEvent = PKSupportsTouches ? "touchstart" : "mousedown";
const PKMoveEvent = PKSupportsTouches ? "touchmove" : "mousemove";
const PKEndEvent = PKSupportsTouches ? "touchend" : "mouseup";
function PKUtils() {}
PKUtils.assetsPath = "";
PKUtils.t = function (b, a) {
return "translate3d(" + b + "px, " + a + "px, 0)"
};