Skip to content

Instantly share code, notes, and snippets.

View anchan828's full-sized avatar

Keigo Ando anchan828

  • Unity Technologies
  • Japan
  • 16:23 (UTC +09:00)
  • X @kyusyukeigo
View GitHub Profile
@anchan828
anchan828 / README.md
Last active April 15, 2024 06:13
This is an improvement to allow @nestjs/typeorm@8.1.x to handle CustomRepository. I won't explain it specifically, but it will help in some way. https://github.com/nestjs/typeorm/pull/1233

You need to provide some classes and decorators yourself to maintain the same style as typeorm@2.x.

1. EntityRepository -> CustomRepository

@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}

//参考: http://wiki.unity3d.com/index.php?title=Singleton
using UnityEngine;
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T>
{
private static T instance = null;
public static T Instance {
get {
//Scene内にあったら取得
import { performance } from 'perf_hooks';
export function timerify<T = any>() {
return function(
target: any,
propertyKey: string,
descriptor: TypedPropertyDescriptor<any>,
) {
const oldDescriptor = descriptor.value;
if (!oldDescriptor) {
@anchan828
anchan828 / CompileError.cs
Last active October 24, 2018 11:31
コンパイルエラーが出たまま再生ボタンを押すと、ドラクエの呪いの効果音を再生する
using UnityEngine;
using UnityEditor;
using System.Reflection;
[InitializeOnLoad]
public class CompileError
{
// 効果音。自由に変更する
// http://commons.nicovideo.jp/material/nc32797
const string musicPath = "Assets/Editor/nc32797.wav";
@anchan828
anchan828 / index.ts
Created June 26, 2018 10:13
Favro webhooks for nodejs
import * as bodyParser from "body-parser";
import * as crypto from "crypto";
import {default as express, Request} from "express";
const app = express();
app.use(bodyParser.json()).post("/", (req: Request, res) => {
const secretKey = "1234";
const str = req.body.payloadId + req.body.hook.url;
const sha1 = crypto.createHmac("sha1", secretKey);
@anchan828
anchan828 / SceneAttribute.cs
Created December 10, 2012 16:36
インスペクターでシーン名をEnumで選択できるプロパティ拡張
using UnityEngine;
public class SceneAttribute : PropertyAttribute
{
public int selectedValue = 0;
public SceneAttribute ()
{
}
}
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
[InitializeOnLoad]
// 大草原クラス
class WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
{
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=27C6C585F2A2204D93E825FAE7479170/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=27C6C585F2A2204D93E825FAE7479170/Shortcut/@EntryValue">AssetDeleteResult</s:String>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=27C6C585F2A2204D93E825FAE7479170/Text/@EntryValue"> static AssetDeleteResult OnWillDeleteAsset (string $assetPath$, RemoveAssetOptions $option$)&#xD;
{&#xD;
$END$&#xD;
}</s:String>
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=27C6C585F2A2204D93E825FAE7479170/Reformat/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/PatternsAndTemplate
@anchan828
anchan828 / gist:5552743
Created May 10, 2013 06:34
Uniduinoで明るさセンサのサンプル
using UnityEngine;
using System.Collections;
using Uniduino;
public class Sample : MonoBehaviour
{
//3.3V
private Arduino arduino;
@anchan828
anchan828 / gist:5552597
Created May 10, 2013 05:36
UniduinoでServoを動かすサンプル
using UnityEngine;
using System.Collections;
using Uniduino;
public class Sample : MonoBehaviour
{
private Arduino arduino;
private int angle;
void Start ()