Skip to content

Instantly share code, notes, and snippets.

@jackysee
jackysee / canvas_img_draw.html
Created August 12, 2014 09:42
canvas load image and draw
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
@jackysee
jackysee / AngularControllerTest.sublime-snippet
Created January 29, 2014 01:56
AngularControllerTest.sublime-snippet
<snippet>
<content><![CDATA['use strict';
describe("Controller : ${1}", function() {
beforeEach(module('${2}'));
var ctrl, scope;
beforeEach(inject(function(\$controller, \$rootScope){
scope = \$rootScope.\$new();
@jackysee
jackysee / AngularDirectiveTest.sublime-snippet
Created January 29, 2014 01:55
AngularDirectiveTest.sublime-snippet
<snippet>
<content><![CDATA[
'use strict';
describe("${1}", function() {
beforeEach(module('${2}'));
var scope, compile, el;
beforeEach(inject(function(\$rootScope, \$compile){
@jackysee
jackysee / AngularBeforeEachInject.sublime-snippet
Created January 29, 2014 01:55
AngularBeforeEachInject.sublime-snippet
<snippet>
<content><![CDATA[beforeEach(inject(function(${1}){
${2}
});]]></content>
<tabTrigger>bfi</tabTrigger>
<scope>source.js</scope>
<description>beforeEach(inject)</description>
</snippet>
@jackysee
jackysee / AngularBeforeEachModule.sublime-snippet
Created January 29, 2014 01:54
AngularBeforeEachModule.sublime-snippet
<snippet>
<content><![CDATA[beforeEach(module('${1}'));]]></content>
<tabTrigger>bfm</tabTrigger>
<scope>source.js</scope>
<description>beforeEach(module)</description>
</snippet>
@jackysee
jackysee / stubprop.js
Last active December 25, 2015 18:39
A handy utility to add stubbed property on obj, it will be cleaned up automatically. One of the use case is require.js module where it shares a global instance.
/**
* Usage:
* describe("someModule", function(){
* beforeEach(function(){
* stubProp(someGlobal, {myVar:'test'});
* });
* });
*
* - stubProp(obj, {myVar:'value'});
* - stubProp(obj, 'myVar', 'myValue');
@jackysee
jackysee / classic-closure.js
Created September 30, 2013 09:18
Code illustrate a classic closure problem
var arr = [1,2,3];
var out = [];
for(var i=0; i<arr.length; i++){
var item = arr[i];
out.push(function(){ alert(item); });
}
out.forEach(function(f){ f(); });
@jackysee
jackysee / twitter-pinboard.user.js
Last active August 31, 2017 06:39
Twitter pinboard shortcut
// ==UserScript==
// @id Twitter pinbaord unread
// @name Twitter pinboard unread
// @namespace http://jacky.seezone.net/twitterpinboardunread
// @description press p to save link in current tweets to pinobard unread
// @include https://twitter.com/*
// @include http://twitter.com/*
// ==/UserScript==
function getTitle(link){
@jackysee
jackysee / EasyMotion.sublime-settings
Created June 26, 2013 04:00
Sublime Text 2 - Easy Motion plugin key config around center
{
"placeholder_chars" : "fjruvmtyghbndkeic,slwox.a;qpz/"
}
// ==UserScript==
// @name Google plus no box shadow
// @author Jacky See
// @include http*://plus.google.com/*
// @version 1.0
// ==/UserScript==
GM_addStyle('.MZxWCd{box-shadow:none!important;border:1px solid #AAA;}');