Skip to content

Instantly share code, notes, and snippets.

#import <Foundation/Foundation.h>
@interface NSString(MD5)
-(NSString*)md5sum;
@end
#import "NSString+MD5.h"
@implementation NSString(MD5)
-(NSString*)md5sum;
{
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/sbin/md5"];
[task setArguments:@[@"-q", self]];
NSAffineTransform *trans1 = [NSAffineTransform transform];
[trans1 translateXBy: 10 yBy: 10];
[trans1 concat];
[self drawLineWithColor:[NSColor redColor]];
[trans1 concat];
[self drawLineWithColor:[NSColor greenColor]];
// .....
@Nunocky
Nunocky / UnityAndroidBackQuit
Created November 14, 2014 00:41
Android + Unity Backボタンでアプリケーションを終了
function Update () {
if (Application.platform == RuntimePlatform.Android)
{
if (Input.GetKey(KeyCode.Home) || Input.GetKey(KeyCode.Escape) || Input.GetKey(KeyCode.Menu))
{
Application.Quit();
return;
}
}
@Nunocky
Nunocky / MainActivity.java
Created December 8, 2014 05:42
OCRTest01 MainActivyty
package org.nunocky.ocrtest01;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.app.AlertDialog;
import android.content.DialogInterface;
void calcWorldSize() {
final float screenRatio = ((float)Gdx.graphics.getWidth()) / Gdx.graphics.getHeight();
final float worldRatio = W / H;
if (screenRatio > worldRatio) {
worldBottomLeft.y = 0;
worldTopRight.y = H;
float w = screenRatio * H;
@Nunocky
Nunocky / gist:3dbca6acd72305643e1b
Created December 16, 2014 02:45
Android camera SurfaceView from libGDX tutorial
package org.nunocky.gdxcamera.android;
import android.content.Context;
import android.hardware.Camera;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import java.io.IOException;
;
@Nunocky
Nunocky / PlaceholderFragment.java
Created February 18, 2015 01:43
Android : 効果音の鳴らし方
public class PlaceholderFragment extends Fragment {
private MediaPlayer mp;
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mp = MediaPlayer.create(getActivity().getApplicationContext(), R.raw.decision17);
@Nunocky
Nunocky / gist:c19b0d99c03dad587fb2
Created March 2, 2015 06:30
nfc-list失敗 (一度成功したあとにもう一度実行)
> LIBNFC_LOG_LEVEL=3 nfc-list
debug libnfc.config key: [allow_intrusive_scan], value: [yes]
debug libnfc.config Unable to open directory: /usr/local/Cellar/libnfc/1.7.0/etc/nfc/devices.d
debug libnfc.general log_level is set to 3
debug libnfc.general allow_autoscan is set to true
debug libnfc.general allow_intrusive_scan is set to true
debug libnfc.general 0 device(s) defined by user
nfc-list uses libnfc 1.7.0
debug libnfc.general 0 device(s) found using arygon driver
debug libnfc.general 0 device(s) found using pn532_uart driver
@Nunocky
Nunocky / gist:0b306a9cf6a106786322
Created March 2, 2015 06:31
nfc-list 1回目 (何も乗せないで実行)
> LIBNFC_LOG_LEVEL=3 nfc-list
debug libnfc.config key: [allow_intrusive_scan], value: [yes]
debug libnfc.config Unable to open directory: /usr/local/Cellar/libnfc/1.7.0/etc/nfc/devices.d
debug libnfc.general log_level is set to 3
debug libnfc.general allow_autoscan is set to true
debug libnfc.general allow_intrusive_scan is set to true
debug libnfc.general 0 device(s) defined by user
nfc-list uses libnfc 1.7.0
debug libnfc.general 0 device(s) found using arygon driver
debug libnfc.general 0 device(s) found using pn532_uart driver