Skip to content

Instantly share code, notes, and snippets.

@fuqunaga
fuqunaga / load_js
Last active December 17, 2015 05:49
javascript:
(function(){
var url = 'http://jsdo.it/Fuqunaga/g_imas.js';
if(!url.match(/\?/))url+='?'+(new Date()).getTime();
var d=document;
var e=d.createElement('script');
e.charset='utf-8';
e.src=url;
d.getElementsByTagName('head')[0].appendChild(e);
})();
@fuqunaga
fuqunaga / Rand
Last active December 24, 2015 09:22
[System.Serializable]
public class RandFloat : Rand<float>
{
public RandFloat(float min, float max) : base(min, max){ }
protected override float _rand(float min, float max) { return UnityEngine.Random.Range(min, max); }
}
[System.Serializable]
public class RandInt : Rand<int>
{
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Linq;
public static class GUIUtil
{
public class Folds : Dictionary<string, Fold>
{
public void Add(string name, Action action, bool enableFirst = false)
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
static class Util
{
static public Vector2 CrossKey(float scale = 1f, bool extraEnable = true)
{
KeyCode[][] keys = new[]{
@fuqunaga
fuqunaga / FindMissingScript
Last active November 29, 2016 11:11
EditorTestRunnerでMissingScriptをチェック
using UnityEngine;
using UnityEditor;
using NUnit.Framework;
using System.Linq;
using UnityEditor.SceneManagement;
public class CommonTest
{
/// <summary>
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System;
public class TimeDebugger : MonoBehaviour
{
#region TypeDefine
@fuqunaga
fuqunaga / MiniJSON.cs
Last active March 15, 2017 11:11 — forked from darktable/MiniJSON.cs
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" for dein
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" deinパス設定
let s:dein_dir = expand('~/.vim/dein/') "<-お好きな場所
let s:dein_repo_dir = s:dein_dir . 'repos/github.com/Shougo/dein.vim' "<-固定
" dein.vim本体の存在チェックとインストール
if !isdirectory(s:dein_repo_dir)
execute '!git clone https://github.com/Shougo/dein.vim' shellescape(s:dein_repo_dir)
@rem
@rem To use this with Visual Studio .Net
@rem Tools->External Tools...
@rem Add
@rem Title - Vim
@rem Command - d:\files\util\vim_vs_net.cmd
@rem Arguments - +$(CurLine) $(ItemPath)
@rem Init Dir - Empty
@rem
@rem Courtesy of Brian Sturk
@fuqunaga
fuqunaga / simple Dijkstra
Created December 11, 2017 06:34
Route search as a Dijkstra whose cost between nodes is always 1
public struct DijkstraData
{
public float cost;
public Node parent;
}
// Route search as a Dijkstra whose cost between nodes is always 1
protected List<Node> CalcRoute(Node from, Node to)
{
List<Node> ret = null;