Skip to content

Instantly share code, notes, and snippets.

View mamboer's full-sized avatar

Levin Van mamboer

View GitHub Profile
@mamboer
mamboer / sync-master-to-gh-pages.txt
Created November 29, 2013 08:24
easily sync your master to GitHub Pages
GitHub tip: easily sync your master to GitHub Pages
On the occasion that you’re working on a web-related project using GitHub, you may want to simply mirror your demo pages or entire master branch over to the Github Pages for your project to make them web-accessible. An example case for this would be the development of a JavaScript tool that includes an “examples/” section. It would be most convenient to just let people browse that as a webpage from GitHub, keeping it up to date every time the master branch changes.
GitHub Pages make it possible to serve web content from a branch of your repository, and the automatic page generator is very nice. To make it work in the example above, though, an update to both the base repository and the website requires at least:
git checkout master
git status
git commit -am "Committing changes to master"
git push origin master
@mamboer
mamboer / jquery-plugin-template.js
Last active December 27, 2015 17:59
A jquery plugin template
/**
* plugin short description
* @author levin
* @version 1.0.0
* @module plugin name
* @class full plugin name like jquery.xxx
* @static
*/
(function($){
//延迟加载模块
/*=====日历控件=========*/
.calendar2{*width:536px;}
.calendar1{*width:268px;}
.calendar{
border: 1px solid #e1e1e1;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
/*Make position:fixed work in IE6!*/
.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0;}
.fixed-bottom /* position fixed Bottom */{position:fixed;bottom:0;top:auto;}
.fixed-left /* position fixed Left */{position:fixed;right:auto;left:0;}
.fixed-right /* position fixed right */{position:fixed;right:0;left:auto;}
* html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;}
* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
* html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
@mamboer
mamboer / webstorm-watchers.xml
Created October 29, 2013 05:13
my webstorm file watchers
<?xml version="1.0" encoding="UTF-8"?>
<TaskOptions>
<TaskOptions>
<option name="arguments" value="--no-color $FileName$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" value="Compiles .less files into .css files" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="less" />
<option name="immediateSync" value="true" />
<option name="name" value="LESS" />
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {
@mamboer
mamboer / bash_aliases.txt
Last active December 25, 2015 20:49
my bash_aliases
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Personal: ~/.bash_aliases
# Levin Wong
#
# Last modified: 2014.07.07
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ———————————————–
body{
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAdLUlEQVR4AU3ch5LYSK5EUZJqeW/+/wflvRe3DjbuBCuCrxyQSCRAttSrN/vPnz/PHz9+bPfv39++fPmynee53bt3b/v27dv28OHD2d+5c2fb933WHz582F68eLHxuXXr1nYcxzzu//79u93c3Gzv37/fHj9+PBh8v3//vj1//nxbsWb96NGj8Wdv7Rwe2wcPHmzGr1+/Bp8NLsbt27fnzIzn79+/JzbuYYvz9evX7e7du9u/f/8GB24YcjI+ffr0H3ecDfZs6WCG8fnz5+3p06cTj4885c1H3H0FO4mAjKQ5/PnzZxJjaLhD2pCoeyJLThDJEklSgBObncFWsI8fP84dn8QWAz4B2CsOLEMsth7kjSdPnsy9GOxxVtSXL19O4mxhVdgKgz9h+eGSaPIlHO7Pnj2bGPGH4T5MGHwJ7E7eh0NqSwiQ2SMJiQEA7gGMnHuDr3NgqkQoHWQe8HVOEGuDbXHYwEvwOuNafQnhQGRCwapL+MEjHpy3b9+OoL057sXQ4ZI2cCs34ssNb3FgENiZAVfB2cEiYnnJR+589vW6TQci5kBAgqgcQwCqLhE2Ek1Ud4Eix0eiEmPDliBI8oeHCHxYigTD4IOUBAlmhsle9ykyIRLAOn82cZGDc/aG8zrSHb/yEgcPOVcI/GseuSWUPOyJTFD4sPf1f06BEJOERF14OAsgYXfWgnqAsCWSWeWRKxC8/N0LbgiMrKSdE9eeLX8xYKt+CXZXDILyU7D4KBgh2IiFL+Hg4XjFIlCvtlmDGH3j+Mezb6o9zuzxk6f5RqISMRwIhDADgRPPXgXZEtddQRCQvHuPOzNh2EgGKX6JiYwEJeOenSFhw5lOgYWPPZ+I+0HlHKZYxCOi19FMYENOxZULkWCVp/ji4H8VHjf4fHAQF0d+8OUM90ZwgF4XpJAMCAEBshE
@mamboer
mamboer / jquery_removeClassByPrefix
Last active December 20, 2015 20:39 — forked from jakubp/gist:2881585
Remove classes that have given prefix
/*
* Remove classes that have given prefix
* Example:
* You have an element with classes "apple juiceSmall juiceBig banana"
* You run:
* $elem.removeClassByPrefix('juice');
* The resulting classes are "apple banana"
* NOTE: discussion of implementation techniques for this, including why simple RegExp with word boundaries isn't correct:
* http://stackoverflow.com/questions/57812/jquery-remove-all-classes-that-begin-with-a-certain-string#comment14232343_58533
* https://gist.github.com/mamboer/6191743
@mamboer
mamboer / oxtip.html
Created July 19, 2013 06:11
jQuery.oxtip.js demo
<!--Step1: add data-oxtipid to the trigger element-->
<a href="javascript:;" data-oxtipid="#tip1">示例1 - hover触发</a>
<!--Step2: prepare your oxtip -->
<div id="tip1" class="mod_hint" style="width: 250px; position: absolute; z-index: 200; left: 712px; top: 148px; display: none;">
<div class="mod_hint_inner">
一个提示浮层的jQuery插件,能够动态计算提示或浮层的位置<br><a href="api/index.html" class="lk_0">查看API文档&gt;&gt;</a>
</div>
<i class="mod_hint_arrow1" style="left: 88px;"></i>
</div>