Skip to content

Instantly share code, notes, and snippets.

View Suave's full-sized avatar
:octocat:
Hiring

Rui Su Suave

:octocat:
Hiring
View GitHub Profile
find . -type d -name ".svn"|xargs rm -rf
@Suave
Suave / gist:107984
Created May 7, 2009 08:06
js 获取 url 参数
<script type="text/javascript">
<!--
function getQueryStringRegExp(name)
{
var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return "";
};
//http://localhost/test.html?aa=bb&test=cc+dd&ee=ff
alert(getQueryStringRegExp('test'));
//-->
@Suave
Suave / gist:702901
Created November 17, 2010 02:45
查看 svn merge 信息
svn propedit svn:mergeinfo .
@Suave
Suave / python-tips
Created November 19, 2010 10:09
经常用经常忘的一些功能
从一个文件里面按行读
f = open(filename, 'r')
while 1:
line = f.readline()
if not line:
break
.....
@Suave
Suave / install ack standalone
Created December 10, 2010 08:52
install ack without macports
wget http://betterthangrep.com/ack-standalone
sudo mv ack-standalone /usr/local/bin/ack
sudo chmod +x /usr/local/bin/ack
@Suave
Suave / .ackrc
Created December 10, 2010 08:55
ack config
# Always color, even piping
--color
# Pager
#--pager=less -r
# Add .ptl file support
--type-add=python=.ptl
@Suave
Suave / gist:2248830
Created March 30, 2012 07:34
homebrew mysql5.1 install failed
% brew install mysql51 -v
==> Downloading http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.58.tar.gz
Already downloaded: /Library/Caches/Homebrew/mysql51-5.1.58.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/mysql51-5.1.58.tar.gz
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file scripts/mysqld_safe.sh
Hunk #1 succeeded at 384 (offset 1 line).
patching file scripts/mysql_config.sh
==> ./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql51/5.1.58 --localstatedir=/usr/local/var/mysql --sysconfdir=/usr/local/etc --with-plugins=innobase,myisam --with-extra-charsets=complex --with-ssl --without-readline --enable-assembler --enable-thread-safe-client --enable-local-infile --enable-shared --with-partition
@Suave
Suave / gist:2248846
Created March 30, 2012 07:35
gcc version
% gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
@Suave
Suave / gist:6127873
Created August 1, 2013 02:05
mysql: truncate all tables in one command line
mysql -Nse 'show tables' DATABASE_NAME | while read table; do mysql -e "truncate table $table" DATABASE_NAME; done
package com.ore;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;