This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by IntelliJ IDEA. | |
* User: hongbo | |
* Date: 4/26/12 | |
* Time: 9:59 AM | |
*/ | |
class Event | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @constructor | |
*/ | |
function Injector() { | |
/** | |
* @type {!Object.<string, function(Injector=): !Object>} | |
*/ | |
this.factories = {}; | |
/** | |
* @type {!Object.<string, !Object>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function declare(Parent, props) { | |
"use strict"; | |
var Factory, Super, i | |
, __construct = props.__construct || function () { | |
} | |
, toArr = function (args) { | |
var a = []; | |
for (var i = 0, l = args.length; i < l; i++) { | |
a[i] = args[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//event naviagor.onLine isn't fiable. | |
function serverReachable() { | |
// IE vs. standard XHR creation | |
var x = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" ), | |
s; | |
x.open( | |
// requesting the headers is faster, and just enough | |
"HEAD", | |
// append a random string to the current hostname, | |
// to make sure we're not hitting the cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @constructor | |
*/ | |
function Injector() { | |
/** | |
* @type {!Object.<string, function(Injector=): !Object>} | |
*/ | |
this.factories = {}; | |
/** | |
* @type {!Object.<string, !Object>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* best breakpoints */ | |
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ } | |
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ } | |
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ } | |
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ } | |
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ } | |
@media (min-width:1281px) { /* hi-res laptops and desktops */ } | |
/* to work better with 960 grids: */ | |
@media (min-width:320px) { /* smartphones, iPhone, portrait 480x320 phones */ } | |
@media (min-width:481px) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sqrt_iter(g, y) { | |
if (Math.abs(g*g - y) < 0.000000000000001) { | |
return g; | |
} else { | |
return sqrt_iter( (g + y / g)/2, y ); | |
} | |
} | |
function sqrt(y) { | |
return sqrt_iter(1.0, y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fact1(x) { | |
if(x<=1) return 1; | |
else return x*fact(x-1); | |
} | |
function fact2(x){ | |
var res=x; | |
while(--x){ | |
res *= x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Stopping Qmail - Japan it UP!" | |
/etc/init.d/qmail stop | |
echo "Clearing the Mail Queue" | |
cd /var/qmail/queue/info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(){ | |
var supportsCSSText = getComputedStyle(document.body).cssText !== ""; | |
return { | |
/** | |
* @method domToImage | |
* @param {HTMLElement} origElem | |
* @param {function(Error,Image)} callback | |
* @param {Object|String} style | |
* @param {String} style.href | |
* @param {Number} style.width |
OlderNewer