Skip to content

Instantly share code, notes, and snippets.

View wangshijun's full-sized avatar

wangshijun wangshijun

View GitHub Profile
@wangshijun
wangshijun / ip.php
Created September 11, 2012 06:21 — forked from MilkZoft/ip.php
php: get user ip address
<?php
function get_client_ip() {
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
if(isset($_SERVER["HTTP_CLIENT_IP"])) {
return $_SERVER["HTTP_CLIENT_IP"];
} else {
return $_SERVER["REMOTE_ADDR"];
}
return $_SERVER["HTTP_X_FORWARDED_FOR"];
@wangshijun
wangshijun / gist:3521924
Created August 30, 2012 03:02
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@wangshijun
wangshijun / CSS
Created August 27, 2012 07:34
Border-Radius
-webkit-border-radius: 3px 3px 0 0;
-khtml-border-radius: 3px 3px 0 0;
-moz-border-radius: 3px 3px 0 0;
-ms-border-radius: 3px 3px 0 0;
-o-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
@wangshijun
wangshijun / hideaddrbar.js
Created August 27, 2012 07:33 — forked from scottjehl/hideaddrbar.js
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){