Skip to content

Instantly share code, notes, and snippets.

@eral
eral / gist:4123759
Last active October 13, 2015 02:18
typenameof
//https://gist.github.com/eral/4123759
#if defined(__INTEL_COMPILER)
# include <cstring>
#endif
#if defined(__GNUC__)
# include <cxxabi.h>
#endif
#include <string>
javascript:(function(){
var w = window;
var d = document;
var u;
var h = d.location.href;
if (-1 != h.search(/^http:\/\/ext\.nicovideo\.jp\/api\/getthumbinfo\/\w{2}\d+/)) {
var v = d.getElementsByTagName("video_id")[0].innerHTML;
h = d.getElementsByTagName("title")[0].innerHTML;
var t = d.getElementsByTagName("length")[0].innerHTML;
w.alert('今日の作業BGM #nowplaying / ' + h + ' (' + t + ') #' + v + ' http://nico.ms/' + v);
@eral
eral / QuaternionEulerPropertyDrawer.cs
Last active August 29, 2015 14:03
Quaternion Euler Property Drawer
// (C) 2014 ERAL
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CustomPropertyDrawer(typeof(QuaternionEulerAttribute))]
@eral
eral / Swizzle.Color.cs
Last active June 6, 2020 18:26
Swizzle extension method
// (C) 2014 ERAL
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
using UnityEngine;
namespace Swizzle {
static class ColorExtensions {
#region Color←1D swizzle
@eral
eral / EnumMaskPropertyDrawer.cs
Last active January 30, 2022 23:32
Enum Mask Property Drawer
// (C) 2014 ERAL
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CustomPropertyDrawer(typeof(EnumMaskAttribute))]
@eral
eral / OriginalMaterial.cs
Last active August 29, 2015 14:05
Original Material
// Created by ERAL
// This is free and unencumbered software released into the public domain.
using UnityEngine;
public class OriginalMaterial : ScriptableObject {
public string m_data;
#if UNITY_EDITOR
private const string menuName = "Original Material";
@eral
eral / CursorPosition.SakuraEditor.js
Last active August 29, 2015 14:07
カーソルを任意の位置に移動させるサクラエディタ用マクロ関数
// Created by ERAL
// This is free and unencumbered software released into the public domain.
function GetCursorPosition() {
return {'x':0|Editor.ExpandParameter('$x'), 'y':0|Editor.ExpandParameter('$y')};
}
function SetCursorPosition(pos) {
var is_text_selected = 0 != Editor.IsTextSelected();
@eral
eral / SelectableMoveBracketPairs.SakuraEditor.js
Last active August 29, 2015 14:07
範囲選択を維持しつつ対括弧の検索を行うサクラエディタ用マクロ
// (C) 2014 ERAL
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
var is_text_selected = Editor.IsTextSelected();
if (1 == is_text_selected) {
Editor.BeginSelect();
}
Editor.BracketPair();
if (1 == is_text_selected) {
@eral
eral / RestrictInterfacePropertyDrawer.cs
Last active June 6, 2020 18:19
Restrict Interface Property Drawer
// (C) 2014 ERAL
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using System.Linq;
@eral
eral / CancelableLinq.cs
Last active August 29, 2015 14:13
Cancelable LINQ
// Created by ERAL
// This is free and unencumbered software released into the public domain.
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
public class CancelableLinq {