Skip to content

Instantly share code, notes, and snippets.

View is8r's full-sized avatar
🙂

Yu Ishihara is8r

🙂
View GitHub Profile
@is8r
is8r / snippets.cson
Last active December 7, 2016 01:27
Atomのスニペット設定
'.source.js':
'console.log':
'prefix': 'co'
'body': 'console.log($1);'
'prev':
'prefix': 'pr'
'body': 'preventDefault();'
'on':
'prefix': 'on'
'body': 'on(\'change\', function(e) {$1})'
@is8r
is8r / gist:8a4b32a0ad1f939daaa108cd50b0ca45
Last active November 18, 2016 02:19
連番の配列を作る配列のprototype拡張
Array.prototype.arrange = function(n){
return Array.from(new Array(n)).map((v,i) => i)
}
//Delayを使用する方法(引数が無い時)
Observable.Return(Unit.Default)
.Delay(TimeSpan.FromSeconds(1.0f))
.Subscribe(_ => {
print("UniRx Observable.Delay");
});
//Delayを使用する方法(引数を渡したい時)
Observable.Return(0)
.Delay(TimeSpan.FromSeconds(1.0f))
//Timerを使用する方法
Observable.Timer(TimeSpan.FromSeconds(1.0f))
.Subscribe(_ => {
print("UniRx Observable.Timer");
});
//TimerFrameを使用する方法
Observable.TimerFrame(1)
.Subscribe(_ => {
print("UniRx Observable.TimerFrame");
DOVirtual.DelayedCall (1.0f, () => {
print ("DOVirtual.DelayedCall");
});
Coroutine coroutine = this.Delay(1.0f, (int id) => {
print("Delay: "+id);
}, 0);
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
public static class MonoBehaviorExtentsion
{
public static IEnumerator DelayMethod<T>(this MonoBehaviour mono, float waitTime, Action<T> action, T t)
{
Coroutine coroutine = DelayUtil.Delay (1.0f, (int id) => {
Debug.Log ("DelayUtil.Delay: "+id);
}, 10);
void Start()
{
Coroutine coroutine = DelayUtil.Delay (1.0f, () => {
Debug.Log ("DelayUtil.Delay");
});
}
/*
* DelayWrapperClass
*
* Example:
Coroutine coroutine = DelayUtil.Delay (1.0f, () => {
Debug.Log ("DelayedCall");
});
DelayUtil.Stop(coroutine);