Skip to content

Instantly share code, notes, and snippets.

View llun's full-sized avatar
:octocat:

Maythee Anegboonlap llun

:octocat:
View GitHub Profile
@llun
llun / Adium crash log
Created November 2, 2010 15:52
It usually crash in evening.
Process: Adium [24764]
Path: /Applications/Adium.app/Contents/MacOS/Adium
Identifier: com.adiumX.adiumX
Version: 1.4 (1.4)
Code Type: X86 (Native)
Parent Process: launchd [153]
Date/Time: 2010-11-02 22:50:00.932 +0700
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6
Process: Adium [24798]
Path: /Applications/Adium.app/Contents/MacOS/Adium
Identifier: com.adiumX.adiumX
Version: 1.4 (1.4)
Code Type: X86 (Native)
Parent Process: launchd [153]
Date/Time: 2010-11-02 23:20:52.162 +0700
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6
@llun
llun / gist:3245558
Created August 3, 2012 07:54
Check empty string speed comparison
var text = '';
var total = 1000000;
var start = new Date().getTime();
for (var index = 0; index < total; index++) {
var isEmpty = /^$/.test(text);
}
var stop = new Date().getTime()
@llun
llun / all.js
Created October 3, 2012 16:26
CORS in Facebook SDK
__d("CORSRequest", ["wrapFunction", "QueryString"], function (a, b, c, d, e, f) {
var g = b('wrapFunction'),
h = b('QueryString');
function i(l, m) {
if (!window.XMLHttpRequest) return null;
var n = new XMLHttpRequest(),
o = function () {};
if ('withCredentials' in n) {
n.open(l, m, true);
Aaron Swartz
We are deeply saddened to hear the news about Aaron Swartz. We extend our heartfelt condolences to Aaron’s family, friends, and everyone who loved, knew, and admired him. He was a truly gifted person who made important contributions to the development of the internet and the web from which we all benefit.
We have had inquiries about JSTOR’s view of this sad event given the charges against Aaron and the trial scheduled for April. The case is one that we ourselves had regretted being drawn into from the outset, since JSTOR’s mission is to foster widespread access to the world’s body of scholarly knowledge. At the same time, as one of the largest archives of scholarly literature in the world, we must be careful stewards of the information entrusted to us by the owners and creators of that content. To that end, Aaron returned the data he had in his possession and JSTOR settled any civil claims we might have had against him in June 2011.
JSTOR is a not-for-profit service and a member of the i
describe("method", function() {
it("should call model with argument", function() {
spyOn(model, 'list').andCallFake(function(page, limit) {
expect(page).toBe(0);
expect(limit).toBe(10);
});
routes.list({ query: { page: 0, limit: 10 }, {});
})
})
@llun
llun / gist:5082353
Last active December 14, 2015 11:50
Expect to run success but got error with below result actual expected 1{}
var chai = require('chai'),
sinon = require('sinon'),
sinon_chai = require('sinon-chai'),
chai_as_promised = require('chai-as-promised'),
should = require('chai').should(),
mongoose = require('mongoose'),
q = require('q');
chai.use(sinon_chai);
chai.use(chai_as_promised);
@llun
llun / gist:5779766
Created June 14, 2013 05:58
JSON as HAML style template
{
"head":
{
"script": {
"attribute": {
"type": "text/javascript",
"src": "http://site/js/application.js"
}
},
"script": {
@llun
llun / gist:9431872
Created March 8, 2014 15:05
Nodejitsu nomem error
error: Error: spawn ENOMEM
error: at errnoException (child_process.js:855:11)
error: at ChildProcess.spawn (child_process.js:802:11)
error: at exports.spawn (child_process.js:626:9)
error: at tailLog (/opt/local/lib/node_modules/solenoid/lib/solenoid.js:473:18)
error: at /opt/local/lib/node_modules/solenoid/lib/solenoid.js:468:15
error: at delay (/opt/local/lib/node_modules/solenoid/node_modules/back/index.js:39:5)
error: at Timer.list.ontimeout (timers.js:101:19)
@llun
llun / figure1
Created April 1, 2014 15:31
setTimeout
setTimeout(function () {
// do something.
}, 1000)