This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ******************************************* | |
| // 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('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); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 | |
| * | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)" | |
| }; |