Skip to content

Instantly share code, notes, and snippets.

View kerryChen95's full-sized avatar

Chen Kairui kerryChen95

  • AutoX
  • Beijing, China
View GitHub Profile
@karbassi
karbassi / index.html
Created October 21, 2010 22:02
How to handle single and double click events separately in javascript.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Single and Double Click</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="the_div"></div>
<span>Double click the block</span>
@paulirish
paulirish / rAF.js
Last active March 5, 2025 08:53
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@Gozala
Gozala / example.js
Created January 29, 2012 03:46
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
@respectTheCode
respectTheCode / static_server.js
Created February 27, 2012 20:36 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
mime = require("mime")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
@lifesinger
lifesinger / gist:2584518
Created May 3, 2012 09:07
eventproxy questions

朴灵的 EventProxy, README 里有个例子:

var proxy = new EventProxy();
var render = function (template, data, l10n){
    _.template(template, data);
};
proxy.assign("template", "data", "l10n", render);
$.get("template", function (template) {
 // something
@paulmillr
paulmillr / active.md
Last active March 2, 2025 12:41
Most active GitHub users (by contributions). https://paulmillr.com

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers
// oldj:设 A = $("#id a"),B = $("#id .c a"),求 A - B。要求:
// 1、不能用 jQuery 等框架;
// 2、兼容 IE6 在内的各大浏览器;
// 3、尽可能高效;
// 4、尽可能简短。
function getWanted() {
var root = document.getElementById('id')
var all = root.getElementsByTagName('*')
@gonghao
gonghao / dabblet.js
Created December 3, 2012 03:34
Untitled
var a = document.createElement('a');
a.href = '/test/hello/world';
alert(a.pathname)
@sofish
sofish / x.html
Created December 6, 2012 16:17
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>css</title>
<style>
a{display:table-cell;background:green;vertical-align:bottom;padding-left:10px;padding-bottom:5px;height:130px;width:250px;}
a:hover{-moz-transition:all ease-in 1s;-webkit-transition:all ease-in 1s;transition:all ease-in 1s;background:#8fc;font-size:40px;}
</style>
</head>
@kejun
kejun / dabblet.css
Created December 7, 2012 02:17
Untitled
.mod {
position: absolute;
width: 300px;
background: #eee;
border: 1px solid #eee;
padding: 0 50px;
-webkit-box-shadow: 0 0 4px 0 rgba(0,0,0,0.2);
-moz-box-shadow: 0 0 4px 0 rgba(0,0,0,0.2);
box-shadow: 0 0 4px 0 rgba(0,0,0,0.2);
top: 50%;