Skip to content

Instantly share code, notes, and snippets.

var db = {
set: function(key, obj) {
localStorage.setItem(key, JSON.stringify(obj));
},
get: function(key) {
var tmp = localStorage.getItem(key);
return (tmp === undefined) ? null : JSON.parse(tmp);
},
@Jxck
Jxck / localstoratge-test.js
Created August 21, 2010 15:29
localStorageの挙動と簡単なラッパー http://jxck.hatenablog.com/entry/20100821/1282412125
module('localStorage',{
setup: function() {
localStorage.clear();
},
teardown: function() {
localStorage.clear();
}
});
test('localStorage exists and has methods',function(){
@Jxck
Jxck / gist:661851
Created November 3, 2010 22:48
je.js
log = function(a,b){
// if(console.log){(a)? console.log(a) : console.log(a);console.log(b);}
};
var je = {
baseURI: '/_je/',
POST: function(docType, data, callback, error) {
var jsonparam = { _doc: JSON.stringify(data) };
$.ajax({
type: 'post',
@Jxck
Jxck / gist:661854
Created November 3, 2010 22:48
test-je.js
log = function(a,b){
if(console.log){(!b)? console.log(a) : console.log(a);console.log(b);}
};
module('je', {
testdata: null,
docType: null,
docId: null,
/**
@Jxck
Jxck / paralell.js
Created January 30, 2011 07:13 — forked from yssk22/paralell.js
/***
* @function make the parallel request filters and finish with the last filter.
*
* @example
*
* misc.parallel(
* func1, func2, func3, func4
* );
*
* func1 ---+
@Jxck
Jxck / 0001-remove-pids-dir.patch
Created March 12, 2011 14:27
remove pids dir patch
From 67b1009502510dbbcdfbfe1621565e81d7422be7 Mon Sep 17 00:00:00 2001
From: Jxck <block.rxckin.beats@gmail.com>
Date: Sat, 12 Mar 2011 23:14:34 +0900
Subject: [PATCH] remove pids dir
---
bin/express | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/bin/express b/bin/express
From 87a1eb5c64fb14cc3d548b67337ae4ba37635233 Mon Sep 17 00:00:00 2001
From: Jxck <block.rxckin.beats@gmail.com>
Date: Sun, 17 Apr 2011 05:05:07 +0900
Subject: [PATCH] mod curl progress-bar option
---
nvm.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nvm.sh b/nvm.sh
@Jxck
Jxck / sample.js
Created May 16, 2011 07:29
mongoose simple sample
var mongoose = require('../lib/mongoose')
, Schema = mongoose.Schema;
var db = mongoose.connect('mongodb://localhost:27017/mydb');
var User = new Schema({
name : String
, age : Number
});
@Jxck
Jxck / map.js
Last active April 10, 2020 03:36
Hadoop Streaming with Node.js
#!/usr/bin/env node
var stdin = process.openStdin();
var stdout = process.stdout;
var input = '';
stdin.setEncoding('utf8');
stdin.on('data', function(data) {
if (data) {
input += data;
@Jxck
Jxck / map.rb
Created May 26, 2011 15:55
Hadoop Streaming with Ruby
#!/usr/bin/env ruby
ARGF.each do |line|
line.chomp!
words = line.split(' ')
printf("%s,1\n", words[8])
end