Skip to content

Instantly share code, notes, and snippets.

@xkyii
xkyii / examsite.json
Last active September 6, 2016 06:29
jkydt.mock
{
"examsites": [
{
"name": "长沙市交警支队科目一考场",
"address": "湖南省长沙市望城区普瑞大道",
"cartype": "A1, A2, A3, B1, B2, C1, C2, C5"
},
{
"name": "长沙支队科目一湘麓分考场",
"address": "湖南省长沙市岳麓区岳麓大道岳麓山大酒店旁",
@xkyii
xkyii / CreateDMG.sh
Last active November 16, 2015 01:25
制作DMG
#!/bin/sh
#from http://blog.csdn.net/zenghao0708/article/details/24330621
LogFile="/private/var/tmp/VTechMakeProductLog.txt";
fun()
{
StateCode=$?
c_time=$(date +%Y/%m/%d" "%H:%M:%S)
/bin/echo "\n$c_time [build dmg] state=[$StateCode]:$1" >> $LogFile
/bin/echo "$2" >> $LogFile 2>&1
}
@xkyii
xkyii / exception_test.cpp
Created April 14, 2014 13:58
C++11Exeption Performance
// VS2013 c++11 gtest
#include <chrono>
#include "gtest/gtest.h"
class ExceptionTest : public testing::Test
{
public:
class TimeCounter
{
public:
Refactor Document Method
/**
* @desc $end$
* @author $Author$ $DATE$
* @param $MethodArg$
* @return $SymbolType$
**/
File header detailed
/********************************************************************
@xkyii
xkyii / display_modify.lua
Created November 11, 2013 07:48
修改quick-x的部分函数
function display.newFrames(pattern, begin, length, isReversed)
local frames = {}
local step = 1
local last = begin + length - 1
if isReversed then
last, begin = begin, last
step = -1
end
@xkyii
xkyii / mulitiColor.cpp
Last active December 17, 2015 10:49
cocos2dx相关片段
// 使用CCLabelBMFont创建文字
// arial16.fnt可以在cocos2d-x包里找到
CCLabelBMFont* label = CCLabelBMFont::labelWithString("Hello World", "arial16.fnt");
label->setPosition(ccp(320, 480));
label->setScale(5);
addChild(label);
// 为每个单独的字设定颜色
for (int i=0; i<label->getChildrenCount(); i++)
{
CCSprite* sub = (CCSprite*)label->getChildByTag(i);
@xkyii
xkyii / embedPython.cpp
Last active December 16, 2015 20:59
Python + C++相关
// get_pyfiles.cpp : 定义控制台应用程序的入口点。
//
#include <Python.h>
#include <Windows.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
{
"cmd": ["/AutoHotkey/App/AutoHotkey.exe", "/ErrorStdOut", "$file"],
"file_regex": "^[ ]*File \"(...*?)\",\nline ([0-9]*)",
"selector": "source.ahk",
"working_dir": "$file_path"
}
@xkyii
xkyii / minizip.cpp
Created January 27, 2013 15:06
Minizip压缩加密示例代码
void crypt_test()
{
zipFile zf = zipOpen("myarch.zip",APPEND_STATUS_ADDINZIP);
int ret = zipOpenNewFileInZip(zf,
"myfile.txt",
&zfi,
NULL, 0,
NULL, 0,
"my comment for this interior file",
Z_DEFLATED,
@xkyii
xkyii / CSingleton.h
Created May 30, 2012 08:59
Singleton
#if !defined(UTILHY_SINGLETON_INCLUDED_)
#define UTILHY_SINGLETON_INCLUDED_
//////////////////////////////////////////
// 使用:
// 1, 继承 public CSingleton<T>
// 2, 增加成员量: friend class CSingleton<T>;
//////////////////////////////////////////
template <class T>
class CSingleton {