Skip to content

Instantly share code, notes, and snippets.

View sofish's full-sized avatar
🚀
still hiring creatives

小鱼 sofish

🚀
still hiring creatives
View GitHub Profile
@sofish
sofish / localstorage-fault.html
Created July 24, 2012 04:16
localstorage 不能直接包
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>LocalStorage fault</title>
<link rel="stylesheet" href="http://typo.sofish.de/typo.css" />
</head>
<body class="typo" style="width:800px;margin:30px auto;">
<h3># error message</h3>
@sofish
sofish / sea.html
Created July 3, 2012 03:25
seajs send 404 request
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Loader</title>
<link href="http://typo.sofish.de/typo.css" rel="stylesheet" />
<style type="text/css">
code{padding:0 2px;border:1px solid #eee;background:#f7f7f7;border-radius:3px;}
</style>
<script src="http://test.com:8080/static/??sea/sea.js,modules/jquery-1.7.2.min.js"></script>
@sofish
sofish / sea.html
Created July 3, 2012 03:00
sea js loader
<script src="http://test.com:8080/static/??sea/sea.js,modules/jquery-1.7.2.min.js"></script>
<script>
seajs.config({
base: 'http://test.com:8080/static/modules'
});
seajs.use('jquery', 'geolocation', function($, geo){
geo(function(coords){
$('#geo').html(coords.latitude + ', ' + coords.longitude);
}, function(err){
alert('error occurred: ' + err);
@sofish
sofish / nginx.md
Created July 2, 2012 14:41
nginx -s stop
~  nginx
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] still could not bind()
➜  ~  sudo nginx -s stop
Password:
@sofish
sofish / geolocation.js
Created July 2, 2012 06:58
geolocation.js
define('geolocation', [], function(require, module, exports){
/*
* @Name: Geolocation
* @Overview: the javascript way to fetch the geolocation
* @Author: sofish Lin <http://sofish.de>
*/
// TODO: error handler for ie
function geo(successCallback, errorCallback) {
@sofish
sofish / sea.html
Created July 2, 2012 02:50
seaj.s demo page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Loader</title>
<script src="./loader/sea.js"></script>
</head>
<body>
<script>
@sofish
sofish / filter-hover.html
Created June 6, 2012 11:24
解决 filter 导致的 :hover 失效 bug
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Sample</title>
<style>
/*
@ 名称: 投影 | drop shadow
@ 用法: 添加 .sl-shadow
array (size=4)
'name' => string 'ie' (length=2)
'version' => string '7.0' (length=3)
'platform' => string 'win' (length=3)
'ua' => string 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; TencentTraveler 4.0)' (length=84)
@sofish
sofish / form-select.js
Created April 26, 2012 08:54
form-select
var formSelect = $('.form-select');
if(formSelect.length) {
var menu = $('.form-select-menu', formSelect),
form = formSelect.parents('form');
formSelect.hover(function(){
$(this).addClass('form-select-open');
}, function(){
$(this).removeClass('form-select-open');
@sofish
sofish / padding.html
Created April 19, 2012 10:37
padding works the same at ie6+/chrome etc.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>non quirks mode padding</title>
</head>
<body>
<div style="width:200px;height:90px;background:#f30;"></div>
<br />