Skip to content

Instantly share code, notes, and snippets.

View fireyang's full-sized avatar

FireYang fireyang

View GitHub Profile
@fireyang
fireyang / gist_tag.rb
Created August 17, 2012 05:49 — forked from BinaryMuse/gist_tag.rb
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@fireyang
fireyang / ios5webdebug.sh
Created October 25, 2012 00:39 — forked from ckotak/ios5webdebug.sh
Runs iOS 5 simulator with MobileSafari remote debug
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3
open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open mobile safari
echo Open mobile safari on emulator and press return
read
# Plug debug to MobileSafari.app
@fireyang
fireyang / Framesync
Created April 9, 2013 13:27
enter frame callback without events
package {
import flash.display.Loader;
import flash.display.MovieClip;
import flash.events.Event;
import flash.system.LoaderContext;
import flash.utils.ByteArray;
public class Framesync {
// Raw SWF bytecode (contains two empty keyframes on the main timeline)
/*
This code takes a 2D transformation matrix described as a one-dimensional array
(in column order, top to bottom and left to right) and decomposes it using the dojo
matrix library. This input matrix should produce a 45-deg X skew:
1 1 0
0 1 0
0 0 1
The output of decompose() looks like this:
####################################################
###欢迎您选用 WWW.HOST700.com VPS 低价 稳定 实惠 ###
####################################################
#开始先配置shadowsocks这个就大概说下
git clone git://github.com/clowwindy/shadowsocks.git
#然后进入
cd shadowsocks
#然后配置下config.json文件
vim config.json #具体的配置自己看很简单
#运行服务端
@fireyang
fireyang / onlytcp.lua
Created October 17, 2013 07:53
quick-cocos2d-x lua socket
--[[
onlytcp lua客户端
因为发现luasocket receive(number)方式的一个奇惨问题 所以收数据改成了按行读取
]]
CONST_Socket_TickTime = 0.1--SOCKET接收信息轮训时间
CONST_Socket_ReconnectTime = 5--socket重连偿试时间时隔
CONST_HeartBeaT_TimeOut = 20--socket心跳超时时间
CONST_HeartBeaT_SendTime = 15--socket心跳发送间隔
CONST_HeartBeaT_CheckTime = 25--socket心跳检查时间
@fireyang
fireyang / atomic_demo.gp
Created January 6, 2014 07:41
atomic测试
// program
package main
import "fmt"
import "sync/atomic"
func main() {
# coding: utf-8
# Original File: https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# Modified by Yu-Cheng Chuang <ducksteven@gmail.com>
# Licensed under MIT License (same as the original file)
# This version of wordpressdotcom.rb is compatible
# with the real-world Wordpress.com export file, which:
#
# - Makes paragraphs (<p>) and line breaks (<br>)
@fireyang
fireyang / quick_lua_complete.lua
Created June 27, 2014 15:44
quick_lua_complete
use strict;
use FindBin qw/$Bin/;
use Data::Dumper;
#my @dirs = ('E:/quick-cocos2d-x/framework/client', 'E:/quick-cocos2d-x/shared');
#my @tolua_dirs = ('E:/quick-cocos2d-x/lib/cocos2d-x/tools/tolua++','E:/quick-cocos2d-x/lib/cocos2dx_extensions_luabinding','E:/quick-cocos2d-x/lib/cocos2dx_extra/build_luabinding');
my @dirs = ('/Volumes/hd2/code_source/quick-cocos2d-x/framework');
my @tolua_dirs = ('/Volumes/hd2/code_source/quick-cocos2d-x/bin/mac/tolua++','/Volumes/hd2/code_source/quick-cocos2d-x/lib/luabinding');
my $rh_parsed = {};
my $library = "quick-lua";
//Workaround for Unity game slowing in iPhone4 + 7.1
//Write in main.mm
#include <pthread.h>
#include <dlfcn.h>
typedef int (*pthread_create_f)(pthread_t * __restrict, const pthread_attr_t * __restrict, void *(*)(void *), void * __restrict);
static pthread_create_f real_create = NULL;
extern "C" int pthread_create(pthread_t * __restrict thread, const pthread_attr_t * __restrict attr, void *(*start)(void *), void * __restrict arg)