Skip to content

Instantly share code, notes, and snippets.

@Kogarasi
Kogarasi / gist:3141039
Created July 19, 2012 05:51
cs_lambda
public class WebClientWrapper
{
public static void WebGetAsync( string url, System.Action<string> callback_func )
{
System.Net.WebClient wc = new System.Net.WebClient();
// 本来の引数型は void ( object, System.Net.DownloadStrignCompletedEventArgs )
// ラムダ関数でラップしてWebGetAsyncの第二引数の関数(System.Action<string> callback_func)を呼び出す。
wc.DownloadStringCompleted += new System.Net.DownloadStringCompletedEventHandler( ( o, e ) => {
callback_func( e.Result );
@Kogarasi
Kogarasi / gist:3629227
Created September 5, 2012 02:13
Youtube APIから受け取ったJSONをGSONを使ってデコードしたい・・・
class YoutubeItemJson
{
public String id;
public String uploaded;
public String updated;
public String uploader;
public String category;
public String title;
public String description;
public List<String> tags;
@Kogarasi
Kogarasi / gist:4084803
Created November 16, 2012 06:29
よくわからない!
<?php
/*
... ここで適当に処理
*/
/* Case:1 意図しない挙動 */
$a = current( $a );
@Kogarasi
Kogarasi / gist:4086692
Created November 16, 2012 11:45
[APC Module] no reset internal array pointer in apc_fetch.
<?php
// APC : version 3.1.9
$retval = apc_add('key', array(1,2,3,4,5));
echo $retval; // true
$retval = apc_fetch('key');
@Kogarasi
Kogarasi / .vimrc
Last active August 17, 2016 07:45
syntax on
set number
set si
set sw=2
set ts=2
set expandtab
set incsearch
set encoding=utf8
set hidden
//================================================================================
//! @file OAuth_v1.cs
//! @brief OAuth認証
//! @date 07/25/2012
//! @author kogarasi
//================================================================================
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
@Kogarasi
Kogarasi / gist:4736316
Last active December 12, 2015 07:28
JsonFxのデコード時のクラス定義を楽にしたい。
using JsonFx.Json;
public class SimpleGeneric {
// 呼び出し側
public void hoge(){
var decodeObject = simpleDecode( "{ a:1; }", new { a=1 } ); // 第二引数は型の指定
}
public T simpleDecode<T>( string jsonString, T _type ){
buildscript {
repositories {
mavenCentral()
mavenRepo urls: 'http://twitter4j.org/maven2'
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
classpath 'com.googlecode.androidannotations:androidannotations:2.7.1'
classpath 'com.googlecode.androidannotations:androidannotations-api:2.7.1'
classpath 'com.h2database:h2:1.3.173'
@Kogarasi
Kogarasi / gist:8951507
Created February 12, 2014 07:46
Scene Class for Cocos2dx v3
#include "cocos2d.h"
template <typename T>
class BaseScene : public cocos2d::Layer {
public:
static cocos2d::Scene* createScene(){
auto scene = cocos2d::Scene::create();
auto layer = T::create();
@Kogarasi
Kogarasi / file0.txt
Last active May 19, 2017 15:05
Android開発ではじめるKotlin ref: http://qiita.com/Kogarasi/items/4bd0a37763b057e9d796
Preference->Plugins->Install JetBrain Plugins