Skip to content

Instantly share code, notes, and snippets.

View girvan's full-sized avatar
Hello World!

Hi girvan

Hello World!
View GitHub Profile
@girvan
girvan / gist:3081824
Created July 10, 2012 07:31
js unittest
"use strict"; // 加了這個,js就要用比較嚴謹的方法來寫,比如,若你沒有宣告變數就直接使用,就會跳出錯誤
// common function
var add_beta = function(url)
{
if(location.href.indexOf('http://beta')!==-1)
return url.replace("http://", "http://beta.");
return url;
}
@girvan
girvan / gist:3204844
Created July 30, 2012 04:58
公平隨機抽獎產生器
<html>
<head>
<style type="text/css">
.help {}
#result { font-weight:bold; font-size: 24px;background-color:yellow;}
a:visited { color:blue; }
.main { font-size:22px; }
#title, #total,#str,#num { width:400px; height:2em;}
.help { cursor:pointer; }
#input-str { position:relative; }
@girvan
girvan / gist:3234447
Created August 2, 2012 06:21
美妝邦 2012.08.02 抽獎留言存檔
來源網址: https://www.facebook.com/photo.php?fbid=261861907258082&set=a.228021387308801.45669.220819334695673&type=1
計算結果 第 10, 20, 7, 8, 1, 5 位
Audrey Fan, Lös Liu, 陳婷婷, 陳藝芳, 林妤宣, 許雅筠
計算方法 http://bit.ly/T4cvGh
計算方法原始碼 https://gist.github.com/3204844
林妤宣 有了美妝邦 看文章變的很方便!
星期一 13:14 · 讚
@girvan
girvan / gist:3265038
Created August 5, 2012 14:10
jump out of iframe
if(top!=self)
{
top.location.href=location.href
}
@girvan
girvan / gist:3366739
Created August 16, 2012 04:11
美妝邦粉絲團 2012.08.16 抽獎活動留言存檔
2012.08.16 12:00 抽獎留言存檔 如下,共72則
從 http://on.fb.me/PmAL3X
----------------------------------
Polly Yang 兩三天畫一次~
星期一 21:26 · 讚
朱珮綺 有出門才會畫~
if (-f $document_root$cache_path) {
rewrite ^ $cache_path last;
}
#!/bin/sh
sudo find /home/wwwroot/cache/piliapp/ -cmin +10 -type f -exec rm {} \;
@girvan
girvan / gist:4160133
Created November 28, 2012 09:28
OO邦如何產生 icons
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-Hant" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" >
<!-- 1352565810 generated -->
<head>
<meta charset="utf-8" />
<style type="text/css">
.site {
width:126px;
function round(num, pos)
{
return (Math.round( num * Math.pow(10,pos) ) / Math.pow(10,pos)).toFixed(pos);
}
<?php
public function ab_jquery()
{
$files = array(
'http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js',
'http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.1/jquery.min.js',
);