Skip to content

Instantly share code, notes, and snippets.

@sumaolin
sumaolin / cloudSettings
Last active August 5, 2021 02:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-08-05T02:57:51.384Z","extensionVersion":"v3.4.3"}
@sumaolin
sumaolin / cloudSettings
Last active January 21, 2020 09:02
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-01-21T09:02:11.893Z","extensionVersion":"v3.2.4"}
@sumaolin
sumaolin / proxyTrack.js
Created March 18, 2019 02:41 — forked from mrharel/proxyTrack.js
Using Proxy to Track Javascript Class
const callerMap = {};
function getCaller(error) {
if (error && error.stack) {
const lines = error.stack.split('\n');
if (lines.length > 2) {
let match = lines[2].match(/at ([a-zA-Z\-_$.]+) (.*)/);
if (match) {
return {
name: match[1].replace(/^Proxy\./, ''),
@sumaolin
sumaolin / media-query.css
Created March 13, 2019 14:53 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@sumaolin
sumaolin / index.js
Last active January 29, 2019 09:19 — forked from edokeh/index.js
funny 注释代码 : 佛祖保佑,永无bug
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
<script type="text/javascript">
var start = 5;
var step = -1;
function count()
{
document.getElementById("div1").innerHTML = "页面将在"+start+"秒后返回登录页面...";
start += step;
if(start <= 0){
start = 5;
//window.location="index.jsp";//返回index.jsp页面
@sumaolin
sumaolin / handleMotionEvent
Created September 18, 2013 02:08
实现一下webapp的手机摇一摇功能 From http://blog.stevezheng.com/903
function handleMotionEvent(event) {
var x = event.accelerationIncludingGravity.x;
var y = event.accelerationIncludingGravity.y;
var z = event.accelerationIncludingGravity.z;
// Do something awesome.
}
window.addEventListener("devicemotion", handleMotionEvent, true);
@sumaolin
sumaolin / 上下无缝滚动
Created August 28, 2013 06:10
轮播图中的上下滚动
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上下无缝滚动</title>
<style type="text/css">
body,div,ul,li{margin:0;padding:0;}
body{background:#052D01;font:12px/1.5 arial;}
#box{position:relative;width:210px;height:700px;border:1px solid #5E8743;margin:20px;}
#box div{position:absolute;top:50%;left:50%;width:160px;height:570px;overflow:hidden;margin:-285px 0 0 -80px;}
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};