usort()関数

// setting data
$arr = [
    ['name']=>'Kan', 'point'=>4],
    ['name']=>'Kenji', 'point'=>5],
    ['name']=>'Akai', 'point'=>3],
    ['name']=>'Genta', 'point'=>4],
    ['name']=>'Shizuka', 'point'=>8],
    ];
    $point_cmp = function ($a, $b) {
        return ($a['point'] < $b['point']) ? -1 : 1;
    };

    usort($arr, $point_cmp);
    //result
    foreach ($arr as $u) {
    echo $u['name'].":".$u['point']."\n";
    }

クイックソート


// quick sort
    function quick_sort(&$arr){
        if (count($arr) < 2) return $arr;
        $left = $right = array();
        $pivot = array_shift($arr);
        foreach ($arr as $v) {
            if ($v < $pivot){
                $left[] = $v;
            } else {
                right[] = $v;
            }
        }
        quick_sort($left);
        quick_sort($right);
        $arr = array_merge($left, array($pivot), $right);
    }


    $arr = array(1,100,24,40,12,4);
    quick_sort($arr);
    echo implode(', ', $arr)."\n";

コムソート

 1 || $swap){
                if ($gap > 1) {
                    $gap = floor($gap / 1.25);
                    if ($gap == 9 || $gap == 10) $gap = 11;
                }
                $swap = false;
                $i = 0;
                while($i + $gap < size) {
                    if ($arr[$i] > $arr[$i + $gap]){
                        $tmp = $arr[$i];
                        $arr[$i] = $arr[$i + $gap];
                        $arr[$i + $gap] = $tmp;
                        $swap = true;
                    }
                    $i++;
                }
                
            }
        }
    }
    $arr = array(100, 3, 30, 20, 44, 32);
    comb_sort($arr);
    echo implode(", ", $arr)."\n"

PHP-Console-Color

isSupported()) {
        echo "did not support color\n"; exit;
    }
    if (!$ccolor->isSupported()){
        echo "did not support color\n"; exit;
}
    if (!$ccolor->are256ColorsSupported()){
        echo "did not support 256 color mode\n"; exit;
}

// write name space class name ---
    $con = new JakubOnderka\PhpConsoleColor\ConsoleColor();
// display stye which is supported
    foreach ($ccolor->getPossibleStyles() as $i => $style){
        echo "[".$ccolor->apply($style, $style)."]";
}
    for ($i = 1; $i <= 255; $i++){
        echo $con->apply("color_$i","*");
        echo $con->apply("bg_color_$i","*");
}
    echo "\n";

JS example

const thingShadow = require('./thing');
const isUndefined = require('./common/lib/is-undefined');
const cmdLineProcess = require('./examples/lib/cmdline');
function processTest( args, argsRemaining ){
if(isUndefined( args.thingName )){
console.log( 'thing name must be specified with --thing-name');
process.exit(1);
}
const thingShadows = thingShadow({
keyPath: args.privateKey,
cerPath: args.clientCert,
caPath: args.caCert,
clientId: args.clientId,
region:args.region,
reconnectPeriod: args.recconectPeriod,
});
thingShadows.on('connect',function(){
console.log('connected to things instance, registering thing name');
thingShadows.register( args.thingName, { persistentSubscribe: true });
});
thingShadows.on('close', function() {
thingShadows.unregister( args.thingName );
console.log('close');
});
thingShadow.on('reconnect', function() {
thingShadows.register( args.thingName, { persistentSubscribe: true });
console.log('offline');
});
thingShadows.on('error', function(error){
console.log('error', error);
});
thingShadows.on('delta', function(thingName, stateObject){
console.log('received delta on '+thingName+':'+
JSON.stringify(stateObject));
thingShadows.update( thingName, { state: { reported: stateObject.state }});
});
thingShadows.on('timeout', function(thingName, clientToken){
console.warn('timeout: '+thingName);
});
}

module.exports = cmLineProcess;
if (require.main === module){
cmdLineProcess('connect to the AWS IoT service and perform thing shadow sample',
    process.argv.slice(2), processTest, '', true)
}

confirm JSON file

gzcat ~/Download/xxx(cut) -xx-part-0001.gz | jq '.' | less
{
    "event_type": "ApplicationStart",
    "event_timestamp": 1446391243721,
    "arrival_timestamp":1446442595071,
    "event_version": "3.0",
    "application":{
        "app_id": "",
        "cognito_identity_pool_id": "us-east-1:",
        "package_name":"net.nowtom.Share",
        "sdk":{
            "name":"aws-sdk-iOS",
            "version":"2.3.4"
        },
        "title":"Unknown",
        "version_name":"1",
        "version_code":"1.0"
    },
    "client":{
        "client_id":"",
        "cognito_id":"us-east-1:"
    },
}

macでsvnを利用する

Windowsなら TortoiseSVN ですが、macなら、ということで、
ターミナルで以下のコマンドを入力してください。
$ svn –version
svn, version 1.7.19
compiled Jun 17 2015, 13:48:11

Copyright (C) 2014 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

svnadmin も確認
$ svnadmin –version
svnadmin, version 1.7.19 (r1643991)
compiled Jun 17 2015, 13:48:11

Copyright (C) 2014 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_fs : Module for working with a plain file (FSFS) repository.

アプリケーション起動時にイベント送信

func application(application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // ...
    let mobileAnalytics =
    AWSMobileAnalytics(forAppId: "ApplicationID")
    let eventClient = mobileAnalytics.eventClient
    let event = eventClient.createEventWithEventType("ApplicationStart")
    eventClient.recordEvent(event)
    eventClient.submitEvent()
    return true
}