Skip to content

Instantly share code, notes, and snippets.

@butihuzi
butihuzi / CookieUtil.as
Last active August 29, 2015 14:05
Flash cookie 封装类
package ez.utils
{
import flash.events.NetStatusEvent;
import flash.net.SharedObject;
import flash.net.SharedObjectFlushStatus;
import flash.utils.ByteArray;
public class CookieUtil extends Object
{
static private const MAX_SAVE:int = 1073741824 ;
@butihuzi
butihuzi / gzipdatabase.php
Last active August 29, 2015 14:05
压缩加密文本为二进制文件
#!/usr/bin/php -q
<?php
$base_dir = dirname(__FILE__);
$file = $base_dir . '/config/database.local.xml';
$output_file = $base_dir . '/../Resources/conf/database.local.xml';
if (file_exists($output_file) && filemtime($file) <= filemtime($output_file)) {
echo "no update for config file\n";
exit();
}
$xml = file_get_contents($file) or exit(1);
@butihuzi
butihuzi / Json.as
Created September 30, 2013 08:56
单文件Json类,在极端追求swf尺寸时可考虑使用。
package {
public class Json {
private static var decoder:JsonDecoder=null;
private static var encoder:JsonEncoder=null;
public static function decode(str:String):* {
if (decoder==null)decoder=new JsonDecoder();
return decoder.decode(str);
@butihuzi
butihuzi / CommUtil.cpp
Created September 23, 2013 09:43
cocos2d-x render to texture with OpenGL CCGLProgram. cocos2d-x 中给 ccSprite 添加灰白滤镜(类似黑白照片效果)。
void CommUtil::disableSprite(CCSprite* sp)
{
const GLchar* pszFragSource =
"#ifdef GL_ES \n \
precision mediump float; \n \
#endif \n \
uniform sampler2D u_texture; \n \
varying vec2 v_texCoord; \n \
varying vec4 v_fragmentColor; \n \
void main(void) \n \
@butihuzi
butihuzi / CommUtil.cpp
Last active December 23, 2015 17:09
cocos2d-x cancel render to texture with OpenGL CCGLProgram. cocos2d-x 取消中给 ccSprite 添加的滤镜效果。
void CommUtil::enableSprite(CCSprite* sp)
{
const GLchar* pszFragSource =
"#ifdef GL_ES \n \
precision mediump float; \n \
#endif \n \
uniform sampler2D u_texture; \n \
varying vec2 v_texCoord; \n \
varying vec4 v_fragmentColor; \n \
void main(void) \n \
@butihuzi
butihuzi / gist:6192811
Last active December 20, 2015 20:48
Flash 扩展开发
// from http://www.cnblogs.com/GameDeveloper/articles/2827583.html
// Flash 扩展开发
//var dom = fl.getDocumentDOM();
//var fileName = dom.name.split(".fla").join(".swf");
//var swfFile = fl.configURI + "WindowSWF/" + fileName;
//dom.exportSWF(swfFile, true);
@butihuzi
butihuzi / git-base
Created February 6, 2012 01:27
git init add commit remote push
mkdir gdp
cd gdp
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:XingCloud/gdp.git
git push -u origin master