Skip to content

Instantly share code, notes, and snippets.

View defims's full-sized avatar

Wei Long defims

View GitHub Profile
@jeffrafter
jeffrafter / Crazy IE getter setter proxy hack.html
Created September 18, 2009 23:34
Crazy IE getter setter proxy hack
<!-- modified from http://alex.dojotoolkit.org/08/jscript/lettable.html -->
<html>
<head>
<title>A Crazy Getter/Setter Hack</title>
</head>
<body>
<script language="VBScript" type="text/VBScript">
Function exec_vb_global(code)
ExecuteGlobal(code)
End Function
@cowboy
cowboy / ba-smallwalker.js
Created May 5, 2011 21:27
Small Walker: A small and simple JavaScript DOM walker
/*!
* Small Walker - v0.1.1 - 5/5/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Walk the DOM, depth-first (HTML order). Inside the callback, `this` is the
@joelambert
joelambert / README
Created June 1, 2011 11:03
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@subzey
subzey / LICENSE.txt
Created June 3, 2011 14:51 — forked from 140bytes/LICENSE.txt
chaining average
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@rwaldron
rwaldron / raf.js
Last active March 1, 2018 10:04
requestAnimationFrame, browser prefix detection
var rAF = "equestAnimationFrame";
window["r"+rAF] = window["r"+rAF] ||
window["webkitR"+rAF] ||
window["mozR"+rAF] ||
window["msR"+rAF] ||
window["oR"+rAF];
// A list
@paulirish
paulirish / rAF.js
Last active June 23, 2024 04:00
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'];
@gre
gre / easing.js
Last active June 13, 2024 12:18
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@shiweifu
shiweifu / lweb.lua
Created June 22, 2012 06:21
lua static webserver
socket = require("socket")
httpcode = require("httpcode")
require("mime")
getMime = mime.getMime
assert(getMime)
function main( p )
local port
// Polyfill for ES6 Object.observe()
// Limitations:
// - No 'splice' (etc); if you're observing an Array, you're gonna have a bad time
(function(global) {
function assert(e) { if (!e) throw new Error('Assertion failed'); }
// http://wiki.ecmascript.org/doku.php?id=harmony:observe
// ECMAScript internal approximations
@divarvel
divarvel / continuation.js
Last active May 27, 2023 08:12
implementation of the continuation monad in JS
console.log("\033[39mRunning tests…");
function assertEquals(actual, expected, description) {
if(typeof actual === "undefined") {
console.error("\033[31m" + description + " not implemented\033[39m");
} else {
if(actual !== expected) {
console.error("\033[31m" + description + " failed, expected " + expected + ", got " + actual + "\033[39m");
} else {
console.log(description + " \033[32m ok\033[39m");
}