Skip to content

Instantly share code, notes, and snippets.

View pantaovay's full-sized avatar
🎯
Focusing

Peter pantaovay

🎯
Focusing
View GitHub Profile
// 糟糕
function initVar($myVar) {
if(!$myVar) {
$myVar = $('#selector');
}
}
// 建议
<?php
class fakeString
{
private $str;
function __construct()
{
$this->str = "";
}
function addA()
// 糟糕
var first = $('#first');
var second = $('#second');
var value = $first.val();
// 建议 - 在jQuery对象前加$前缀
var $first = $('#first');
var $second = $('#second'),
// 糟糕
h = $('#element').height();
$('#element').css('height',h-20);
// 建议
$element = $('#element');
h = $element.height();
$element.css('height',h-20);
@pantaovay
pantaovay / multiblank
Created December 9, 2013 15:43
合并多行空白
#!/bin/sh
#author: God Tao
multi_blank() {
for filename in `ls -A $1`
do
if [ -d "$1/$filename" ]
then
multi_blank "$1/$filename"
else
cat -s "$1/$filename" > "$1/$filename.cat"
# 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
@pantaovay
pantaovay / gist:6821078
Last active December 24, 2015 15:29
Delete directory in Qiniu cloud storage using Python and Qiniu's Python SDK.
# -*- coding: utf-8 -*-
#author: pantaovay@gmail.com
#date: 2013/10/4
import qiniu.conf
import qiniu.rs
import qiniu.rsf
import sys.stderr
qiniu.conf.ACCESS_KEY = "<YOUR_APP_ACCESS_KEY>"
# 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/
@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>