Skip to content

Instantly share code, notes, and snippets.

View xhinking's full-sized avatar

Wang xhinking

  • HangZhou
  • 07:34 (UTC +08:00)
View GitHub Profile
@xhinking
xhinking / slide.js
Created June 9, 2011 14:28
Github Tree Slide
$('#slider a').click(function() {
history.pushState({ path: this.path }, '', this.href)
$.get(this.href, function(data) {
$('#slider').slideTo(data)
})
return false
})
@xhinking
xhinking / unslide.js
Created June 10, 2011 01:50
Github Tree Slide2
$(window).bind('popstate', function() {
$('#slider').slideTo(location.pathname)
})
@xhinking
xhinking / detect.py
Created July 2, 2011 13:26
Google Language Detect Ajax Web Service
From -> http://www.cnblogs.com/zhengyun_ustc/archive/2010/10/26/1860897.html
#############
import urllib
import httplib2
try:
from base import easyjson
except:
pass
<!doctype html>
<html>
<head>
<title>知乎阅读</title>
<meta charset="utf-8">
<meta name="MobileOptimized" content="1024">
<meta name="HandheldFriendly" content="True">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://static.zhihu.com/static/img/reader/ipad-icon.png?ver=3" />
<link rel="apple-touch-startup-image" href="http://static.zhihu.com/static/img/reader/ipad-splash-landscape.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" />
<link rel="apple-touch-startup-image" href="http://static.zhihu.com/static/img/reader/ipad-splash-portrait.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)" />
<link rel="stylesheet" href="http://static.zhihu.com/static/css/reader/main.css?v=1.8" type="text/css" media="screen" />
<script type="text/javascript" src="http://static.evernote.com/noteit.js"></script>
<script type="text/javascript" src="http://static.zhihu.com/static/img/reader/scrollability.min.js"></script>
</head>
<script type="text/javascript">
function addEventSimple(obj,evt,fn){
if(obj.addEventListener){
obj.addEventListener(evt,fn,false);
}else if(obj.attachEvent){
obj.attachEvent('on'+evt,fn);
}
}
addEventSimple(window,'load',init);
function init(){
@xhinking
xhinking / timelien.php
Created July 25, 2012 04:01
PHP timeline function
<?php
function tranTime($time) {
$rtime = date("m-d H:i",$time);
$htime = date("H:i",$time);
$time = time() - $time;
if ($time < 60) {
$str = '刚刚';
}
@xhinking
xhinking / post.php
Created January 16, 2013 06:03
Give WordPress Posts An Even-Odd Class. via -> http://gregrickaby.com/2012/05/wordpress-posts-even-odd-class.html
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div id="post-<?php the_ID(); ?>" <?php $even_odd = (++$j % 2 == 0) ? 'even-post' : 'odd-post'; post_class( $even_odd ); ?>
<p><?php the_excerpt(); ?><>
</div>
<?php endwhile; endif; ?>
%%$@_$^__#)^)&!_+]!*@&^}@[@%]()%+$&[(_@%+%$*^@$^!+]!&_#)_*}{}}!}_]$[%}@[{_@#_^{*
@##&{#&{&)*%(]{{([*}@[@&]+!!*{)!}{%+{))])[!^})+)$]#{*+^((@^@}$[**$&^{$!@#$%)!@(&
+^!{%_$&@^!}$_${)$_#)!({@!)(^}!*^&!$%_&&}&_#&@{)]{+)%*{&*%*&@%$+]!*__(#!*){%&@++
!_)^$&&%#+)}!@!)&^}**#!_$([$!$}#*^}$+&#[{*{}{((#$]{[$[$$()_#}!@}^@_&%^*!){*^^_$^
]@}#%[%!^[^_})+@&}{@*!(@$%$^)}[_!}(*}#}#___}!](@_{{(*#%!%%+*)^+#%}$+_]#}%!**#!^_
)@)$%%^{_%!@(&{!}$_$[)*!^&{}*#{!)@})!*{^&[&$#@)*@#@_@^_#*!@_#})+[^&!@*}^){%%{&#@
@{%(&{+(#^{@{)%_$[+}]$]^{^#(*}%)@$@}(#{_&]#%#]{_*({(])$%[!}#@@&_)([*]}$}&${^}@(%
(%[@%!}%*$}(*@)}){+@(%@*$&]*^*}*]&$[}*]%]+*}^!}*$^^_()#$^]++@__){&&+((#%+(&+){)$
%&&#($[[+##*%${)_!+{_[})%++)$#))]]]$]@]@($+{&%&%+!!!@]_]+])^*@$(@#${}}#}{%}#+{(@
#__+{{]${]!{(%${%%^)(_*_@+)$]$#_@$)]](}{}$(}*%+!}#+)$%$}+#@*&^{##}+@(%[*@_}{(^]^
@xhinking
xhinking / pc1.py
Created March 21, 2013 17:29
Python Challenge Level 1 Code
str = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
def Crack(c):
if c != '(' and c != ')' and c != '.' and c != '\'' and c != ' ':
c = ord(c) + 2
if c >= 123:
c = 97 + c - 123
return chr(c)
else:
return c