Skip to content

Instantly share code, notes, and snippets.

@nowri
nowri / IDisplayObject.as
Created April 30, 2012 09:39
既存のクラスをインターフェイス化する簡単な方法
public interface IDisplayObject
{
function get asDisplayObject():DisplayObject;
}
@nowri
nowri / Sample.as
Created April 30, 2012 13:57
PureMVCTestCase for PureMVC Multicore + FlexUnit4
//--------------------------------------------------------------------------
//
// FacebookAPI処理のためのModelクラス、FacebookProxyのテストケースサンプル
//
//--------------------------------------------------------------------------
public class FacebookProxyTest extends PureMVCTestCase
{
private static var facade : ApplicationFacade;
private static var appProxy : AppProxy;
@nowri
nowri / gist:2594116
Created May 4, 2012 10:56
setIntervalOptimizer.js
// http://d.hatena.ne.jp/amachang/20060924/1159084608
// ここのやつがリンク切れしてたのでarchiveからもってきた
var _si_nativeSetInterval = setInterval;
var _si_nativeClearInterval = clearInterval;
var _si_intervalTime = 10;
var _si_counter = 1;
var _si_length = 0;
var _si_functions = {};
var _si_counters = {};
@nowri
nowri / params.as
Created May 24, 2012 11:17
HandwrittenAnimation usage
time:Number //ループの秒数
fps:int=20 //fps
radius:int=5 //スプライン曲線の大きさ
line_weight:Number=0.5 //線の太さ
line_densitydensity:Number=0.3 //密度 0-1
color:int=-1 //色(-1だと読み込んだBitmapdataの色が使われる)
is_sync:Boolean=false //同期か非同期か
@nowri
nowri / gist:2823227
Created May 29, 2012 08:12
FlashBuilder Comment Template(Flex規約準拠)
//--------------------------------------------------------------------------
//
//
// @author : ${user}
// @date : ${date}
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
@nowri
nowri / gist:2867286
Created June 4, 2012 08:43
Using-the-same-mediator-with-more-than-one-view.as
// --------------------------------------------------------------------------
//
// 1つのMediatorに複数のViewComponentを割り当てる
//
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// 1. ステージ上に配置された任意のMovieClipに割り当て
// --------------------------------------------------------------------------
mediatorMap.mapView(MovieClip, BaseButtonMediator, null, false);
@nowri
nowri / ChildView.as
Created June 28, 2012 08:30
Robotlegs robotlegs-utilities-Modular sample
// --------------------------------------------------------------------------
//
//
// @author : nowri.ka
// @date : 2012/05/29
//
// --------------------------------------------------------------------------
package
{
public class ChildView extends Sprite implements IModule
@nowri
nowri / sample1.php
Created July 12, 2012 11:00
YoutubeのURLからIDのみ抜き出す
preg_replace('/.*v=([\d\w]+).*/', '$1', 'http://www.youtube.com/watch?v=1O6aOHb4Zv0')
@nowri
nowri / gist:3664370
Created September 7, 2012 08:34
数字の桁ごと切り出し
var number:Number = 123;
var n100:int;
var n10:int;
var n0:int;
n100 = Math.floor(number/100);
n10 = Math.floor(number/10)%10;
n0 = number%100%10;
@nowri
nowri / gist:3930948
Created October 22, 2012 10:56
改行削除
private function removeParagraphString(str:String):String
{
//操作したい文字列が入るよ
//\nを削除
str= str.replace( /\n/g, "" );
//\rを削除
str= str.replace( /\r/g, "" );
return str;
}