Skip to content

Instantly share code, notes, and snippets.

@Homlean
Homlean / reset.css
Created May 7, 2013 08:02
css reset
/*------------------------------------------------------------------------------------
Global Styles
------------------------------------------------------------------------------------*/
* {
padding:0;
margin:0;
}
h1, h2, h3, h4, h5, h6, p, pre, blockquote, label, ul, ol, dl, fieldset, address { margin:1em 0; }
li, dd { margin-left:5%; }
fieldset { padding: .5em; }

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@Homlean
Homlean / get_sina_weibo_cookie.php
Last active December 14, 2015 20:08
get SUE & SUP with user name & password
@Homlean
Homlean / insert-img.user.js
Created March 1, 2013 09:12
chrome user script
// ==UserScript==
// @name 任意网址插入图片
// @namespace http://appxyz.com
// @version v1.0
// @include http://*/*
// ==/UserScript==
var img = document.createElement('img');
img.src= 'http://i.leica.cc/wp-content/uploads/2013/02/weixin.png';
@Homlean
Homlean / sso.js
Last active January 29, 2019 08:31
新浪sso登陆
/**
* ssologin.js
*/
function SSOController() {
var me = this; // use in private function
var updateCookieTimer = null;
var updateCookieTimeHardLimit = 1800; // 在该时间内不允许更新cookie,默认30分钟
var cookieExpireTimeLength = 3600 * 24; // cookie过期时间为24小时
var crossDomainForward = null ; // 广播操作完成后执行的动作
@Homlean
Homlean / resize.js
Created December 19, 2012 07:33
延迟resize
// 绑定 resize 重新定位事件
var timeout;
Overlay.allOverlays = [];
$(window).resize(function() {
timeout && clearTimeout(timeout);
timeout = setTimeout(function() {
$(Overlay.allOverlays).each(function(i, item) {
// 当元素隐藏时,不处理
if(!item.get('visible')) {
return;
@Homlean
Homlean / strCut.php
Created December 7, 2012 03:45
php string 截取
// 字符截取
// Truncate ?
function strCut($sourceStr, $cutLength) {
$result = '';
$i = 0;
$n = 0;
$sourceStrLen = strlen($sourceStr);
while (($n < $cutLength) and ($i <= $sourceStrLen)) {
$temp = substr($sourceStr, $i, 1);
@Homlean
Homlean / _snippet.html
Created July 20, 2012 07:44 — forked from elijahmanor/_snippet.html
Differences Between jQuery .bind() vs .live() vs .delegate() vs .on() Methods
<ul id="members" data-role="listview" data-filter="true">
<!-- ... more list items ... -->
<li>
<a href="detail.html?id=10">
<h3>John Resig</h3>
<p><strong>jQuery Core Lead</strong></p>
<p>Boston, United States</p>
</a>
</li>
<!-- ... more list items ... -->
@Homlean
Homlean / timeDiff.js
Created June 1, 2012 08:26
javascript timeDiff
var timeDiff = function(){
var d, time;
return {
setStartTime:function (){
d = new Date();
time = d.getTime();
},
getDiff:function (){
d = new Date();
return (d.getTime()-time);