Skip to content

Instantly share code, notes, and snippets.

@sivagao
sivagao / JS:UI-imgfancyzoom.js
Last active December 16, 2015 00:59
JS:UI-imgfancyzoom.js
// Generated by CoffeeScript 1.3.3
/**
* CSS
#zoom-box {
background: white;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(50, 50, 50, 0.75);
padding: 10px;
z-index: 1000;
@sivagao
sivagao / JS:UX-goTop(smooth move)
Last active December 15, 2015 21:50
JS: goTop(smooth move)
$(document).ready(function() {
$('.goto-top').click(function(event) {
event.preventDefault();
move(documentScrollTop());
//window.scrollTo(0, 0);
});
});
//获取或设置文档对象的scrollTop
//function([val])
@sivagao
sivagao / FE: Toolkit-showcase bespoke.js
Created April 6, 2013 14:50
FE: Toolkit-showcase bespoke
Bespoke.js
To create a Bespoke.js presentation, follow these 3 simple steps:
Create a page with required slide markup and resources
Activate your deck via the JavaScript API
Create a custom style sheet using the Bespoke.js classes
<link rel="stylesheet" href="theme.css">
<aritle>
@sivagao
sivagao / html5_websql_stickynotes.html
Created April 6, 2013 14:49
HTML5: WebSQL - stickynotes
<!doctype html>
<html manifest="StickyNotes.manifest">
<head>
<title>WebKit HTML 5 SQL Storage Notes Demo</title>
<style>
body {
font-family: 'Lucida Grande', 'Helvetica', sans-serif;
}
@sivagao
sivagao / minimal_pubsub.js
Created April 2, 2013 10:02
minimal pubsub js
var pubsub = function(l, u, r, i) { // cool! 闭包并且初始化vars
return function(n, f) {
r = l[n] = l[n] || [], i = -1;
if (f && f.call) r.push(f);
else while (r[++i]) r[i].apply(u, arguments);
}
}({});
// subscribe to event
pubsub("eat_cookie", function() {
@sivagao
sivagao / mini_conditional_loader.js
Created April 2, 2013 09:48
minimal sequent conditional scripts loader
function(b) {
// extra functions, test, variables here
// it's a closure !
function c() { // k=[]会被滤掉, onload后再次仔细c(), e.shift();
if (d = e.shift()) a = b.body.appendChild(b.createElement("SCRIPT")), a.onload = c, a.src = d
}
var K = [],
e = K.concat(
@sivagao
sivagao / zombie.py
Created April 2, 2013 08:40
python pygame canvas - 自己维护个内部数据数组, 定期更新display.
############################################################################################
### ###
### PyGame with a SnowPea shoot bullet for defensing the zombie army coming ###
### ###
### Author: Junjie Shi ###
### Email : [email protected] ###
### ###
### Do Enjoy the game! ###
### You need to have Python and PyGame installed to run it. ###
### Run it by typing "python zombie.py" in the terminal ###
var http = require('http'),
url = require('url');
var todos = [{
id: 1,
title: 'aa',
done: false
}, {
id: 2,
title: 'bb',
done: true
@sivagao
sivagao / postData_.py
Created March 25, 2013 08:10
轮询wifi密码
import HTMLParser
import httplib
from datetime import datetime
import time
import urllib
#import urllib2,cookielib
def postData(name, password):
user = "username"
pwd = "password"
@sivagao
sivagao / aperture.html
Created March 23, 2013 08:24
close the light.. 给body的mousemove绑定事件,移动aperture_track的位置{其内部四子相对于上下左右,中间留白.} 同时,对于aperture-top等是在track图片的四周部分,利用rgba来设定0.8黑.
<div id="aperture-wrap" style="width:1160px;height:1px;pointer-events: none;">
<div style="position: fixed; width: 100%; height: 100%; z-index: 99998; top: 0px; left: 0px; background-color: black; opacity: 0.8; display: none;"></div>
<div style="position: absolute; background-image: url(http://a.xnimg.cn/imgpro/onehour2/where.png); width: 434px; height: 215px; z-index: 99999; zoom: 1; left: 477px; top: 219.5px; display: none; background-position: initial initial; background-repeat: initial initial;"></div>
<div id="aperture-track" style="position: absolute; z-index: 99999; top: -183px; left: -249px; display: none;">
<div style="position: absolute; background-image: url(http://a.xnimg.cn/imgpro/onehour2/aperture-top.png); width: 548px; height: 269px; background-position: initial initial; background-repeat: initial initial;"></div>
<div style="position: absolute; background-image: url(http://a.xnimg.cn/imgpro/onehour2/aperture-left.png); top: 269px; width: 264px; height: 20px; backgr