This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 从未知编码的二进制流中读取文本 | |
* @param ba | |
* @param len 读取长度,默认为-1,则读取至文件尾 | |
* @return | |
*/ | |
public static function readString(ba:ByteArray,len:int = -1):String | |
{ | |
if ((len != -1 && len > ba.bytesAvailable) || (len == -1)) len = ba.bytesAvailable; | |
var encode:String = 'gb2312'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//给数组原型增加一个获取随机数组元素的方法:randomItem | |
Array.prototype.getRandomItem = function(): * | |
{ | |
return this[Math.floor(Math.random() * this.length)]; | |
}; | |
//这里设置这个方法不可被(for...in、foreach...in)枚举,非常重要! | |
Array.prototype.setPropertyIsEnumerable('getRandomItem', false); | |
var arr:Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* User: Ray Yee | |
* Date: 14-3-6 | |
* All rights reserved. | |
*/ | |
package | |
{ | |
import flash.filters.ColorMatrixFilter; | |
public class ColorMatrixUtility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"selector": "source.jsfl", | |
"cmd": ["Flash" ,"$file"], | |
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2013 Amos Laber | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add alpha to RGB color | |
* @param rgb | |
* @param a | |
* @return | |
*/ | |
public static function addAlpha( rgb:uint, a:uint = 0xFF ):uint | |
{ | |
return (a << 24) | rgb; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ================================================================================================= | |
// | |
// based on starling.text.TextField | |
// modified to use text layout framework engine for rendering text | |
// | |
// ================================================================================================= | |
package starling.extensions | |
{ | |
import flash.display.BitmapData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package starling.extensions.DistanceFieldFont | |
{ | |
import flash.geom.Rectangle; | |
import flash.utils.Dictionary; | |
import starling.display.Image; | |
import starling.text.BitmapChar; | |
import starling.textures.Texture; | |
import starling.textures.TextureSmoothing; | |
import starling.utils.HAlign; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public const c0:Number = 2.515517; | |
public const c1:Number = 0.802853; | |
public const c2:Number = 0.010328; | |
public const d1:Number = 1.432788; | |
public const d2:Number = 0.189269; | |
public const d3:Number = 0.001308; | |
/** | |
* 正态分布的随机数.a控制波形的顶点,b控制波形的扁度 | |
* @param a 如a是0即,随机出0的机率会大到-1,1,-2,2,然后递减 | |
* @param b 如b是2即,随机出>-2和<2之间的数字机率最大(注意这里的b 是方差,等于标准差的平方) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rayyee; | |
import org.apache.http.HttpStatus; | |
import org.apache.http.client.methods.CloseableHttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClients; | |
import org.apache.http.util.EntityUtils; | |
import java.io.File; |
OlderNewer