Skip to content

Instantly share code, notes, and snippets.

View htom78's full-sized avatar

htom78

View GitHub Profile
@htom78
htom78 / miimoo
Created August 30, 2011 08:16
ajax page loader
function cat_refresh(cat_id) {
jQuery("#grid-wrapper").load("http://www.miimoo.com/?page_id=2&cat=" + cat_id, function(msg) {
jQuery('#grid-wrapper').html(msg);
jQuery('#grid-pagination').html(jQuery('#grid-pagination-cat').html());
jQuery('#grid-pagination-cat').hide();
jQuery('#grid-wrapper').vgrefresh(null, null, null, function(){
jQuery(this).fadeIn(300);
});
jQuery('#single-wrapper').slideUp();
});
www:
requirements:
- faye
- jade
@htom78
htom78 / .vimrc
Created April 20, 2012 06:59 — forked from cloud8421/.vimrc
Set up Vim on Mac or Linux. curl https://raw.github.com/gist/2426726/vim.sh | sh
" this is the configuration file for linux and mac systems
" symlink this to your home folder as .vimrc
" It loads pathogen and loads all modules from ~/.vim/bundles.
" It then loads ~/.vimrc_main which has the main
" configuration that works across all systems.
call pathogen#runtime_prepend_subdirectories(expand('~/.vim/bundles'))
call pathogen#helptags()
source ~/.vimrc_main
@htom78
htom78 / .vimrc
Created April 20, 2012 07:16 — forked from napcs/.vimrc
Set up Vim on Mac or Linux. final. curl https://raw.github.com/gist/2426799/vim.sh | sh
" this is the configuration file for linux and mac systems
" symlink this to your home folder as .vimrc
" It loads pathogen and loads all modules from ~/.vim/bundles.
" It then loads ~/.vimrc_main which has the main
" configuration that works across all systems.
call pathogen#runtime_prepend_subdirectories(expand('~/.vim/bundles'))
call pathogen#helptags()
source ~/.vimrc_main

Vim Cheatsheet

Generally helpful stuff

Open a file for editing             :e path/to/file.txt
Return to Normal mode               ESC   or <CTRL>+C

Navigating around text

@htom78
htom78 / gist:2698651
Created May 15, 2012 02:31
curl cert的解决方案
#to download the cert
wget http://curl.haxx.se/ca/cacert.pem
#to let curl use it for the next calls
export CURL_CA_BUNDLE=~/cacert.pem
@htom78
htom78 / gist:2767243
Created May 22, 2012 07:07
douban common, use as: Do('common')
(function () {
var a = /http:\/\/movie.douban.com\/sogou_search|http:\/\/audit.douban.com/;
if (self !== top && document.referrer.search(a) === -1) {
top.location = self.location
}
})();
if (top.location !== self.location && document.referrer.search(/http:\/\/[^\/]+\.douban\.com/i) !== 0) {
top.location = self.location
}
var Douban = Douban || {};
var subscribeInfoIndex = 14;
function infoScroll(){
if(subscribeInfoIndex >= 0){
$($(".subscribeInfo")[subscribeInfoIndex]).slideDown();
$($(".subscribeInfoText")[subscribeInfoIndex]).fadeTo(1, 0).fadeTo(1500, 1);
subscribeInfoIndex --;
}else{
subscribeInfoIndex = 15;
$(".subscribeInfo").each(function(i){
@htom78
htom78 / gist:2886073
Created June 7, 2012 02:03
魅族首页导航切换的动画效果
(function($){$.fn.lavaLamp=function(o){o=$.extend({fx:"linear",speed:500,click:function(){}},o||{});return this.each(function(){var b=$(this),noop=function(){},$back=$('<li class="back"><div class="left"></div></li>').appendTo(b),$li=$("li",this),curr=$("li.current",this)[0]||$($li[0]).addClass("current")[0];$li.not(".back").hover(function(){move(this)},noop);$(this).hover(noop,function(){move(curr)});$li.click(function(e){setCurr(this);return o.click.apply(this,[e,this])});setCurr(curr);function setCurr(a){$back.css({"left":a.offsetLeft+"px","width":a.offsetWidth+"px"});curr=a};function move(a){$back.each(function(){$.dequeue(this,"fx")}).animate({width:a.offsetWidth,left:a.offsetLeft},o.speed,o.fx)}})}})(jQuery);
if($("#1").get(0)){
$(function() {
$("#1").lavaLamp({
fx: "backout",
speed: 700,
click: function(event, menuItem) {
//window.location.href=event.target.href;
return true;
}
@htom78
htom78 / gist:3892571
Created October 15, 2012 13:54
微信分享去朋友圈代码
function shareToPengYouQuan(imgurl, link, title, desc){
if(typeof WeixinJSBridge !== "undefined"){
WeixinJSBridge.invoke('shareTimeline',{
"img_url": imgurl || "",
"link": link,
"desc": desc,
"title": title
},function(res){
WeixinJSBridge.log(res.err_msg);
});