Skip to content

Instantly share code, notes, and snippets.

@joeylin
joeylin / lightJQ.html
Created January 6, 2014 03:34
a lightweight jquery plugin patterns
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
/*!
@joeylin
joeylin / keyEventDetect.js
Last active December 30, 2015 21:19
common process to key event
// key name
var key_names = {
32: 'SPACE',
13: 'ENTER',
9: 'TAB',
8: 'BACKSPACE',
16: 'SHIFT',
17: 'CTRL',
18: 'ALT',
20: 'CAPS_LOCK',
@joeylin
joeylin / angularPluginNote.js
Created November 24, 2013 14:22
some common codes used in every third part merged angular plugin
// Garbage collection
// below example
// change third plugin to angular service
// used in most station
scope.$on('$destroy', function() {
$modal.remove();
});
@joeylin
joeylin / QunitTemplate.js
Created November 22, 2013 08:16
a jQuery Quint test suit example
(function($) {
/*
======== A Handy Little QUnit Reference ========
http://api.qunitjs.com/
Test methods:
module(name, {[setup][ ,teardown]})
test(name, callback)
expect(numberOfAssertions)
stop(increment)
@joeylin
joeylin / ghostPlugin.js
Last active November 10, 2018 23:41 — forked from jgable/index.js
a ghost plugin example
var fs = require('fs'),
path = require('path'),
_ = require('underscore'),
when = require('when'),
express = require('express'),
GhostPlugin = require('../../../core/server/plugins/GhostPlugin'),
knex = require('../../../core/server/models/base').Knex,
KudosPlugin;
KudosPlugin = function (ghost) {
@joeylin
joeylin / promise.js
Last active December 28, 2015 13:38
Create your own promise
var util = require('util');
var events = require('events');
function Promise(done) {
Promise.super_.call(this);
this.results = null;
this.errors = null;
this.ended = false;