Skip to content

Instantly share code, notes, and snippets.

View sundayu's full-sized avatar

Dayu Sun sundayu

  • Cisco
  • Hangzhou/CN
  • 17:14 (UTC +08:00)
View GitHub Profile
/*
Script: Event.js
Contains the Browser native event enhancement, to make the event object completely crossbrowser.
License:
MIT-style license.
*/
function Event(event){
if ((event = event || window.event).event) event = event.event;
@subtleGradient
subtleGradient / BuildSugar.SubtleGradient.js
Created January 15, 2010 12:34
BuildSugar—Provides a bizarrely clean & simple syntax sugar for building HTML/XML strings
/*
---
provides : BuildSugar
version : 0.1alpha1
description : Provides a bizarrely clean & simple syntax sugar for building HTML/XML strings
source : http://gist.github.com/278016
git : git://gist.github.com/278016.git
demo : http://jsfiddle.net/SubtleGradient/4W3RR/
author : Thomas Aylott
@iansym
iansym / jquery.pubsub.js
Created July 28, 2010 16:06
PubSub functionality
/**
* Package: jQuery PubSub
* a lightweight and fast jQuery Publish/Subscribe system
* based on the jQuery plugin by Peter Higgins (dante@dojotoolkit.org)
* http://higginsforpresident.net/js/jq.pubsub.js
*/
(function(window) {
var subscriptions = {},
cache = {},
we,
@paulirish
paulirish / utmstrip.user.js
Last active April 11, 2024 07:53
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.2
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http*://*
// ==/UserScript==
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@ded
ded / parallel.js
Created July 21, 2011 01:10
call multiple async methods in parallel and receive the result in a callback
function parallel() {
var args = Array.apply(null, arguments)
, callback = args.pop()
, returns = []
, len = 0
args.forEach(function (el, i) {
el(function () {
var a = Array.apply(null, arguments)
, e = a.shift()
if (e) return callback(e)
@strathmeyer
strathmeyer / handlebars.object_helpers.js
Created November 16, 2011 21:57
Handlebars.js helpers to iterate over objects
// HELPER: #key_value
//
// Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}}
//
// Iterate over an object, setting 'key' and 'value' for each property in
// the object.
Handlebars.registerHelper("key_value", function(obj, fn) {
var buffer = "",
key;
@rauchg
rauchg / ms.md
Created December 21, 2011 00:25
Milliseconds conversion utility.
@quietlynn
quietlynn / 12306.user.js
Created January 3, 2012 12:01
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011-2012 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
@paulirish
paulirish / rAF.js
Last active July 19, 2024 19:50
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'];