Skip to content

Instantly share code, notes, and snippets.

@kyubuns
kyubuns / prism-theme-github.css
Created April 19, 2020 15:44
prism.js github theme
code,
code[class*='language-'],
pre[class*='language-'] {
color: #24292e;
text-align: left;
white-space: pre;
word-spacing: normal;
tab-size: 4;
hyphens: none;
}
public static class Dummy
{
public static void Run()
{
Debug.Log("Run!");
Observable.Timer(TimeSpan.FromSeconds(1))
.Subscribe(x =>
{
if (Random.Range(0, 2) == 0) Success?.Invoke();
else Failed?.Invoke("エラーメッセージ");
@:generic
class ArrayWrapper<T>
{
public function new() {}
public var value: Array<T> = [];
#if cs
public function toTyped(): List_1<T>
{
class ArrayTest
{
public var hoges: Array<Hoge>;
}
class Hoge
{
public var x: Int;
public var y: Int;
public var z: Int;
@kyubuns
kyubuns / a.ts
Last active March 28, 2020 08:41
export interface Fuga {
id: string
}
let hoge = {}
hoge['id'] = 'a_text'
hoge['dummy'] = 'dummy_text'
let fuga = (<Fuga>hoge) // エラーになってくれーー頼むーー
class CharacteristicWrapper {
constructor(rawCharacteristic) {
this.rawCharacteristic = rawCharacteristic
this.uuid = rawCharacteristic.uuid.replace(/-/g, "")
this.properties = ["notify"]
}
toBuffer(ab) {
var buf = toio.scanner.Buffer.alloc(ab.byteLength);
var view = new Uint8Array(ab);
@kyubuns
kyubuns / Demo.cs
Created February 21, 2020 16:24
BasicShapeSpriteDemo
using System.Collections.Generic;
using System.Threading.Tasks;
using AnimeTask;
using BasicShapeSprite;
using UnityEditor;
using UnityEngine;
public class Demo : MonoBehaviour
{
[SerializeField] private List<Square> squares = new List<Square>();
@kyubuns
kyubuns / Component.cs
Last active February 3, 2020 16:48
Breakout
using System.Collections.Generic;
using Breakout.Component;
using Component;
using MessagePack;
namespace Component
{
[Union(0, typeof(KTransform))]
[Union(3, typeof(KCubeRenderer))]
[Union(4, typeof(KScale))]
https://github.com/kyubuns/AnimeTask
await UniTask.WhenAll(
// x
new UniTask(
async () =>
{
await Anime.Play(
Easing.Create<Linear>(
startPosition.x,
CompositeResolver.RegisterAndSetAsDefault(new IJsonFormatter[]
{
new IntValueFormatter<Gold>(x => new Gold(x)),
new IDFormatter<StageID>(x => new StageID(x)),
}, new[]
{
StandardResolver.Default,
});
// -----