Skip to content

Instantly share code, notes, and snippets.

@pantaovay
pantaovay / navigation.js
Created November 4, 2012 11:24 — forked from pala/navigation.js
jquery keyboard navigation
$(function(){
$(document).keydown(function(e) {
var url = false;
if (e.which == 37 || e.which == 74) { // Left arrow and J
{% if page.previous %}
url = '{{page.previous.url}}';
{% endif %}
}
else if (e.which == 39 || e.which == 75) { // Right arrow and K
{% if page.next %}
@pantaovay
pantaovay / .gitconfig
Created November 9, 2012 20:49 — forked from liuyix/.gitconfig
Github via goagent
[http]
proxy = http://127.0.0.1:8087
sslVerify = false #注意一定要添加这一行用以解决“ SSL certificate problem: unable to get local issuer certificate”
[https]
proxy = http://127.0.0.1:8087
@pantaovay
pantaovay / goagent.pac
Created November 9, 2012 20:51
goagent paas pac
function regExpMatch(url, pattern) {
try { return new RegExp(pattern).test(url); } catch(ex) { return false; }
}
function FindProxyForURL(url, host) {
if (shExpMatch(url, "*://*.amazonaws.com/*") || shExpMatch(url, "*://amazonaws.com/*")) return 'PROXY 127.0.0.1:8088';
if (shExpMatch(url, "*://*.amazon.com/*") || shExpMatch(url, "*://amazon.com/*")) return 'PROXY 127.0.0.1:8088';
if (shExpMatch(url, "*://*.google.com/*") || shExpMatch(url, "*://google.com/*")) return 'PROXY 127.0.0.1:8088';
if (shExpMatch(url, "*://*.google.com.*/*") || shExpMatch(url, "*://google.com.*/*")) return 'PROXY 127.0.0.1:8088';
if (shExpMatch(url, "*://*.google-analytics.com/*") || shExpMatch(url, "*://google-analytics.com/*")) return 'PROXY 127.0.0.1:8088';
@pantaovay
pantaovay / stat_goagent.sh
Created November 9, 2012 20:51 — forked from hewigovens/stat_goagent.sh
Simple script for goagent statistic
#!/bin/bash
python_count=0
toggle_count=0
local_count=0
log_list=$(ls /etc/httpd/logs/access_log*)
for log in $log_list
do
tmp=$(cat $log | grep python | wc -l)
@pantaovay
pantaovay / .htaccess
Created November 16, 2012 02:37 — forked from yurydelendik/.htaccess
CORS for pdf.js
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "http://mozilla.github.com"
</IfModule>
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
reboot
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
<?php
require_once dirname(__FILE__) . '/../lib/simpletest/autorun.php';
function retry($f, $delay = 10, $retries = 3)
{
try {
return $f();
} catch (Exception $e) {
if ($retries > 0) {
sleep($delay);