Skip to content

Instantly share code, notes, and snippets.

View hongkheng's full-sized avatar
🐢
doing hobby stuff

HongKheng Yap hongkheng

🐢
doing hobby stuff
View GitHub Profile
@cballou
cballou / new-csshook-template.js
Created November 3, 2012 11:19
Creating jQuery CSS3 Vendor Prefix Mixins with $.cssHooks
(function($) {
if ( !$.cssHooks ) {
throw("jQuery 1.4.3+ is needed for this plugin to work");
return;
}
function styleSupport( prop ) {
var vendorProp, supportedProp,
capProp = prop.charAt(0).toUpperCase() + prop.slice(1),
prefixes = [ "Moz", "Webkit", "O", "ms" ],
@gfranko
gfranko / jquery.ui.widget.js
Created February 10, 2013 19:44
AMD Compatible jQueryUI Widget Factory
/*! jQuery UI - v1.10.0 - 2013-02-10
* http://jqueryui.com
* Includes: jquery.ui.widget.js
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */
;(function (widgetFactory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.ui.widget", ["jquery"], function() {
@serrynaimo
serrynaimo / gist:faeec7f3c1d55e300fa1
Last active March 29, 2016 08:45
Interesting UX resources
// code taken from visionmedias node-querystring
var qs = (function () {
var qs = {}
/**
* Object#toString() ref for stringify().
*/
var toString = Object.prototype.toString;
/**
@sfrdmn
sfrdmn / index.html
Created December 6, 2011 09:20
D3 Mouseover Example w/ trailing infobox
<html>
<head>
<meta charset="utf-8">
<title>Mouse Over and Out with Moving Infobox</title>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/fe671a70e236710412a514fa276e59f875f3c617/d3.js"></script>
<link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<!-- I've only commented changes relevant to this mouse follow stuff -->
<!-- btw, this is what an html comment looks like -->
@reifman
reifman / Parse query string via javascript
Last active February 27, 2017 15:28
Javascript to parse query string variables from URL
<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&amp;");
for (var i=0;i&lt;vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
@you-think-you-are-special
you-think-you-are-special / Singleton.js
Created February 18, 2015 10:52
ES6 Singleton example. Use: import Singleton from 'Singleton'; let instance = Singleton.instance;
'use strict';
/**
* Created by Alexander Litvinov
* Email: alexander@codeordie.ru
* May be freely distributed under the MIT license
*/
let singleton = Symbol();
let singletonEnforcer = Symbol();
@adamjmcintyre
adamjmcintyre / gist:3098766
Created July 12, 2012 15:15
Using CSS keyframe animationend event cross-browser with jQuery
$('.some-els').bind('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function(){
// Do something!
$(this).removeClass('animation-class');
})
.addClass('animation-class');
// One works, too
$('.some-els').one('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function(){
// Do something once!
console.log('this would show once');
@rayfranco
rayfranco / README.md
Created April 7, 2014 23:42
Convert YML to JSON with gulp

Convert YML to JS with gulp

This was a very straightforward workaround I used in a project to get things done while the assemble team is working on some serious converter gulp-convert.

@mugifly
mugifly / blink.css
Last active April 25, 2018 06:30
CSS Blink for Webkit and others. (Chrome, Safari, Firefox (Gecko), IE, ...) CSSで擬似的なblinkを再現する簡単なTips。