Skip to content

Instantly share code, notes, and snippets.

View MaxCloud83's full-sized avatar

Max.K MaxCloud83

  • Tokyo
View GitHub Profile
//
// ViewController.swift
// Demo
//
// Created by mountain on 2017/01/23.
// Copyright © 2017年 mountain. All rights reserved.
//
import UIKit
import AVFoundation
//
// UIKit001ViewController.swift
//
import UIKit
class UIKit001ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
@MaxCloud83
MaxCloud83 / sample.java
Created August 27, 2014 10:17
SharedPreferences save & read ArrayList
//Save
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = sharedPrefs.edit();
Gson gson = new Gson();
String json = gson.toJson(arrayList);
editor.putString(TAG, json);
editor.commit();
@MaxCloud83
MaxCloud83 / testKinesis.java
Last active August 29, 2015 14:02
AWS Kinesis PutRecordRequest
AWSCredentials credentials = new BasicAWSCredentials("YOUR_ACCESSKEY", "YOUR_SECRETKEY");
kinesisClient = new AmazonKinesisClient(credentials);
kinesisClient.setEndpoint("ENDPOINT_URL");
final String myStreamName = "myFirstStream";
// Write 10 records to the stream
for (int j = 0; j < 1; j++) {
PutRecordRequest putRecordRequest = new PutRecordRequest();
putRecordRequest.setStreamName(myStreamName);
putRecordRequest.setData(ByteBuffer.wrap(this.createLog().getBytes()));
@MaxCloud83
MaxCloud83 / EncryptedLocalStore.1.as
Created May 29, 2014 07:47
Adobe Air for iOS localstore
//http://help.adobe.com/ja_JP/FlashPlatform/reference/actionscript/3/flash/data/EncryptedLocalStore.html
var str:String = "Bob";
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes(str);
EncryptedLocalStore.setItem("firstName", bytes);
var storedValue:ByteArray = EncryptedLocalStore.getItem("firstName");
trace(storedValue.readUTFBytes(storedValue.length)); // "Bob"
EncryptedLocalStore.removeItem("firstName");
@MaxCloud83
MaxCloud83 / files_delete.sh
Last active August 29, 2015 14:01
files delete batch
#!/bin/sh
DIR=$(dirname "$0")
FILE=files.txt
for f in `cat $DIR/$FILE`; do
echo $DIR/$f;
done
// prepare parameters
Map<String, String> reqParams = new HashMap<String, String>();
//...
//Volley JsonObjectRequest
JsonObjectRequest json = new JsonObjectRequest(Method.POST,"http://your.domain.here/",reqParams,
new Listener<JSONObject>(){
public void onResponse(JSONObject result) {
}
}, new Response.ErrorListener() {
public void onErrorResponse(VolleyError error) {
public static VolleyError parseVolleyError(String TAG, VolleyError volleyError) {
if (volleyError.networkResponse != null && volleyError.networkResponse.data != null) {
VolleyError error = new VolleyError(new String(
volleyError.networkResponse.data));
volleyError = error;
}
Log.e(TAG, volleyError.getMessage());
return volleyError;
}