Skip to content

Instantly share code, notes, and snippets.

View nashibao's full-sized avatar

Naoki Shibayama nashibao

View GitHub Profile
@nashibao
nashibao / karte_asp_api.md
Last active August 29, 2015 13:56
How to connect karte asp api to your app.

How to connect karte api to your app

  1. request for creating(updating) a project(per store) in karte
  2. embed js code in html header
  • [APP_PUBLIC_KEY] & [APP_PRIVATE_KEY] would be sent from karte.io per app.

1. request for creating(updating) a project in karte

@nashibao
nashibao / co-gate-sample.js
Created January 13, 2014 04:35
co-gate sample script.
// require co
var co = require('co')
, Gate = require('co-gate')
, fs = require('fs');
co(function *(){
// create gate
var gate = new Gate()
, val = undefined;
@nashibao
nashibao / simple_co.js
Last active January 2, 2016 10:59
for study.
var co = function(fn){
// callback
var done = function(val){
// yieldに値を流し込む
gen.next(val);
}
// make a generator
var gen = fn(done);
// start
gen.next();
@nashibao
nashibao / co.js
Last active January 2, 2016 09:09
minimum coroutine module (without error handling, dictionary). like https://github.com/visionmedia/co.
var co = function(fn){
function is_gen(obj) {
return obj && obj.constructor && 'GeneratorFunctionPrototype' == obj.constructor.name;
}
return function(done){
var gen = fn;
if(typeof gen == 'function')
gen = gen();
@nashibao
nashibao / virtual_knockout.jade
Last active January 31, 2016 11:07
jade mixins for knockout.js virtual element. https://github.com/visionmedia/jade/pull/958
mixin with(val)
<!-- ko with: !{val} -->
block
<!-- /ko -->
mixin if(val)
<!-- ko if: !{val} -->
block
<!-- /ko -->
@nashibao
nashibao / gist:6059118
Last active December 20, 2015 02:49
How is a 'this' argument changed in javascript ? ref: [じゃあ this の抜き打ちテストやるぞー](http://qiita.com/KDKTN/items/0b468a07410d757ac609)
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
'use strict';
var a, b, c, e, f, fnc;
a = function(){
@nashibao
nashibao / sync_tactics.md
Created October 24, 2012 07:23
sync tactics

settings

server side settings

  • updated_at : update time
  • pk (guid) : identifier which is unique belong all devices.
  • is_active (is_deleted)
  • is_conflicted(transient, default=false)

client side settings

  • updated_at: the same as server side
@nashibao
nashibao / gist:3039677
Created July 3, 2012 13:23
example answer..
codes = {}
def convert(tag):
return codes.setdefault(tag, 1 << codes.length)
def desc(node):
for child in node.childs:
child_code = convert(child.tag)
child.code = child_code | node.code
// Node.h
class Node {
String name; //id
Node** children;
Node* parent;
int numOfChildren;
String* nameList;
int layernum;