Skip to content

Instantly share code, notes, and snippets.

View yangboz's full-sized avatar
:octocat:
lifelong learner

yangbo.zhou yangboz

:octocat:
lifelong learner
View GitHub Profile
@yangboz
yangboz / hash256_hmac Objective-C
Created March 23, 2013 13:36
Hash-based message authentication code Ref:http://en.wikipedia.org/wiki/HMAC
- (NSString*) HMACWithSecret:(NSString*)secret andData:(NSString *)data
{
CCHmacContext ctx;
const char *key = [secret UTF8String];
const char *str = [data UTF8String];
unsigned char mac[CC_SHA256_DIGEST_LENGTH];
char hexmac[CC_SHA256_DIGEST_LENGTH];
char *p;
CCHmacInit( &ctx, kCCHmacAlgSHA256, key, strlen( key ));
@yangboz
yangboz / AIRAntJUnitTest
Created January 21, 2014 03:27
Ant xml example(AIRAntJUnitTest) for FLEX/AS3 code j-unit test.
<?xml version="1.0"?>
<project name="AIRAntUnitTest" default="build">
<!-- TODO Change to your Flex SDK directory -->
<property name="flex.sdk.dir" value="C:\Software\FLEX\sdks\4.6.0" />
<property name="lib.dir" value="${basedir}/libs" />
<!-- ATTENTION: Since we remove the reports directory during the clean target it get's
deleted so DO NOT specifiy any directory which you do not want to be deleted!!! -->
@yangboz
yangboz / flexunit-with-code-coverage
Created January 21, 2014 03:29
Ant xml example(flexunit-with-code-coverage) for FLEX/AS3 code unit test with code coverage reporting.
<?xml version="1.0" encoding="UTF-8"?>
<project name="flexunit-with-code-coverage" default="test" basedir=".">
<!-- =========================================================================================================================================
============================================================= PROPERTY DEFINITIONS =============================================================
========================================================================================================================================== -->
<property environment="env" />
<property name="FLEX_HOME" value="C:\Software\FLEX\sdks\4.6.0" />
<property name="output.loc" value="${basedir}/target" />
@yangboz
yangboz / AIRAntJUnitTestClover
Created January 21, 2014 03:30
Ant xml example(AIRAntJUnitTestClover) for FLEX/AS3 code j-unit test with colver reporting.
<?xml version="1.0"?>
<project name="AIRAntUnitTest" default="build">
<!-- TODO Change to your Flex SDK directory -->
<property name="flex.sdk.dir" value="C:\Software\FLEX\sdks\4.6.0" />
<property name="lib.dir" value="${basedir}/libs" />
<property name="src.dir" value="${basedir}/src" />
<!-- ATTENTION: Since we remove the reports directory during the clean target it get's
@yangboz
yangboz / App42API_call_snippet
Created February 10, 2014 14:51
App42 API call with try...catch block
@try{
//App42 service API call here.
}@catch (App42BadParameterException *ex) {
NSLog(@"BadParameterException found,status code:%d",ex.appErrorCode);
}@catch (App42SecurityException *ex) {
NSLog(@"SecurityException found!");
}@catch (App42Exception *ex) {
NSLog(@"App42 Exception found:%@",ex.description);
//NSAlert here.
}
@yangboz
yangboz / Jenkins-static-analysis.jelly
Created February 25, 2014 08:12
static-analysis.jelly with Status/AllChanges/Artifacts/PMD/JUnitTest/Cobertura reporting.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<STYLE>
BODY, TABLE, TD, TH, P {
font-family:Verdana,Helvetica,sans serif;
font-size:11px;
color:black;
}
h1 { color:black; }
h2 { color:black; }
@yangboz
yangboz / FLEX4.6.0_Air3.8_build_swc.xml
Last active August 29, 2015 13:57
FLEX ant file with as3 library project feature
<?xml version="1.0" encoding="utf-8"?>
<!-- This build file provdes a close approximation of the build process
and build settings inside Flash Builder, but it is not an exact copy.
Please customize this file as necessary. -->
<!-- Generated from project settings as of 3/18/14 6:45 PM -->
<project name="XXXXLib1.0" default="build" basedir=".">
<property name="FLEX_HOME" value="C:\Software\FLEX\sdks\4.6.0_Air3.8"/>
<property name="SDK_VERSION" value="4.6.0"/>
@yangboz
yangboz / Obj-C_Singleton.m
Created March 25, 2014 01:42
Obj-C_Singleton.m example code
//
// Common Objective-C Singleton Class.m
// iOS
//
// Created by yangboz on 03-25-14.
// Copyright (c) 2013年 GODPAPER. All rights reserved.
//
#import "App42_API_Utils.h"
@yangboz
yangboz / free-transform-manager.as
Created March 25, 2014 07:44
free-transform-manager sample code
package
{
import com.ryan.geom.FreeTransformManager;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
[ [ 21.596119999999999,
112.0187,
"YUEJIANGCHENG90609",
2,
78,
26,
"CN",
412477316,
15,
23,