Skip to content

Instantly share code, notes, and snippets.

@satoshikumano
satoshikumano / rest_testing_example.go
Created November 9, 2015 10:59
Rest API testing in Go lang
package MyTest
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"testing"
)
# -*- coding: utf-8; -*-

import httplib2
import json
import sys
import codecs
import urllib

sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
#include <iostream>
#include <thread>
#include <functional>
#include <map>

class hoge {
public:
    int num;
    hoge(const hoge& rv)
- (IBAction)onClick:(id)sender {
    NSDate *d = [[NSDate alloc]init];
    double now = [d timeIntervalSince1970];
    NSString *username = [NSString stringWithFormat:@"user-%f", now];
    KiiUser *user = [KiiUser userWithUsername:username andPassword:@"1234"];
    [user performRegistrationWithBlock:^(KiiUser *user, NSError *error) {
        if (error != nil) {
            NSLog(@"error on reg: %@", error);
            return;
@satoshikumano
satoshikumano / ObjectUri.mkd
Last active August 29, 2015 13:57
Loading Object from Uri (Unity)
// Omitting error handling to simplify the code.

// First time object creation on Kii Cloud.
KiiObject userProf = Kii.Bucket("myBucket").NewKiiObject();
userProf["userProf1"] = "prof value1";
userProf["userProf2"] = "prof value2";
userProf.Save();

// Store Object Uri in local storage.
@satoshikumano
satoshikumano / CountQueryUnity.mkd
Created March 24, 2014 07:22
Count Query in Unity
using UnityEngine;
using System.Collections;
using System.Net;
using System.IO;
using JsonOrg;

public class NewBehaviourScript : MonoBehaviour {

	private string message = "";
var group1 = new KiiGroup.groupWithName("MyGroup");
group1.save({
success: function(savedGroup) {
// uri of the group.
var uri = savedGroup.objectURI();
// create another instance of group references group1
var group2 = new KiiGroup.groupWithURI(uri);
group2.refresh({
success: function(refreshedGroup) {
var groupName = refreshedGroup.getName();

Query

"bucketQuery" : {
  "clause" : {
    "type": "geodistance",
    "field": "mylocation",
    "center": {
        "_type": "point",
        "lat": 11.0,
 "lon": 1.0