Skip to content

Instantly share code, notes, and snippets.

View hisasann's full-sized avatar
🔖
I aspire to become a bookseller.

Yoshiyuki Hisamatsu hisasann

🔖
I aspire to become a bookseller.
View GitHub Profile
@hisasann
hisasann / videoを画面いっぱいに広げるスタイル
Created February 24, 2014 04:09
JavaScriptを使わずに実現できた
#note-vignette {
position: absolute;
right: 0;
top: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
}
tell application "System Events"
key down control
keystroke (ASCII character 28)
key up control
end tell
[applescript]
tell application "System Events"
key down control
keystroke (ASCII character 29)
key up control
end tell
[/applescript]
@hisasann
hisasann / ExportAssetBundles.cs
Created April 16, 2014 08:46
AssetBundle用のエディター拡張
// C# の例
// プロジェクト ウィンドウの選択されたオブジェクトからアセットバンドルを作成
// コンパイルした後は "Menu" -> "Assets" へ移動して選択肢から一つを選択して
// アセットバンドルをビルド
using UnityEngine;
using UnityEditor;
public class ExportAssetBundles
{
[
@hisasann
hisasann / arguments.callee.caller.js
Created July 4, 2014 04:56
呼び出し元の引数を破壊する
function func1(b) {
func2();
console.log(b); // IEではfalse
}
function func2(fn) {
arguments.callee.caller.arguments[0] = false; // 破壊した!
}
func1(true);
@hisasann
hisasann / arguments.callee.js
Created July 4, 2014 05:03
thisがarguments.calleの作用で変化してしまう
var global = this;
(function (b) {
if (b) {
console.log(global === this, '1'); // true
arguments.callee();
return;
}
console.log(this[0]); // true
@hisasann
hisasann / getPageSize.js
Created August 21, 2014 07:05
IE6を含めた画面のサイズ、画面のスクロール領域を含むサイズの取得関数
function getPageSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
var ua = navigator.userAgent.toLowerCase();
$.ua = {
isWindows: /windows/.test(ua), // Windows
isMac: /macintosh/.test(ua), // Mac
isIE: /msie (\d+)/.test(ua), // IE
isIE6: /msie (\d+)/.test(ua) && RegExp.$1 == 6, // IE6
isIE7: /msie (\d+)/.test(ua) && RegExp.$1 == 7, // IE7
isLtIE9: /msie (\d+)/.test(ua) && RegExp.$1 < 9, // IE9未満
isFirefox: /firefox/.test(ua), // Firefox
isWebKit: /applewebkit/.test(ua), // WebKit
@hisasann
hisasann / DetectLeaks.cs
Created August 29, 2014 10:48
Unityのメモリリークを調査するための可視化
using UnityEngine;
using System.Collections;
public class DetectLeaks : MonoBehaviour
{
void OnGUI ()
{
GUI.color = Color.black;
GUILayout.BeginArea (new Rect (10, 80, 400, 800));
@hisasann
hisasann / DestroyObject.cs
Created August 29, 2014 10:49
GameObjectを破棄するときにMaterialも破棄するメソッド
private void DestroyObject ()
{
foreach (Transform t in transform) {
Destroy (t.gameObject.renderer.material);
Destroy (t.gameObject);
}
Destroy (gameObject.renderer.material);
Destroy (gameObject);
}