Skip to content

Instantly share code, notes, and snippets.

View jiangrongyong's full-sized avatar

jiangrongyong jiangrongyong

View GitHub Profile
@jiangrongyong
jiangrongyong / sql.php
Created September 27, 2013 03:27
construct sql with implode
<?php
function construct_sql($base, $logic, $clauses, $suffix = '') {
// initialise array to avoid warnings/notices on some PHP installations
$queries = array();
// create array of strings to be glued together by logic
foreach ($clauses as $key => $value)
$queries[] = "`" . escape($key) . "`='" . escape($value) . "'";
// add a space in case $base doesn't have a space at the end and glue clauses together
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
@jiangrongyong
jiangrongyong / wow_ipfw_fwd
Created June 1, 2013 04:32
魔兽世界服务器,通过防火墙重定向
sudo ifconfig lo0 223.252.234.193 alias
sudo ipfw add fwd 223.252.236.216,3724 tcp from me to 223.252.234.193 dst-port 3724
@jiangrongyong
jiangrongyong / demo.js
Created November 1, 2012 02:40
jquery object array-like
var c = {};
c[0] = 'ab';
console.log(c);
c.length = 1;
c.splice = [].splice;
console.log(c);
@jiangrongyong
jiangrongyong / index.html
Created July 24, 2012 15:09
this use proxy
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a id="btn1" href="javascript:void(0);">btn1</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="index.v3.js" type="text/javascript"></script>
@jiangrongyong
jiangrongyong / index.html
Created July 24, 2012 14:48
about this in js
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a id="btn1" href="javascript:void(0);">btn1</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="index.v2.js" type="text/javascript"></script>