Skip to content

Instantly share code, notes, and snippets.

@hirokim
hirokim / remakeImageForOrientation.m
Created December 18, 2014 08:55
UIImageの向きを統一するために作り直す処理
// 度数をラジアンに変換するマクロ
static inline double radians (double degrees) {return degrees * M_PI/180;}
/**
* UIImageの向きを統一するために作り直す
*
*/
+ (UIImage*)remakeImageForOrientation:(UIImage*)originalImage {
// 変換が不要なものはそのままリターン
@hirokim
hirokim / TrimmingSquareView.h
Created December 15, 2014 01:46
切り取り範囲の矩形を選択するクラス
#import <UIKit/UIKit.h>
@interface TrimmingSquareView : UIView
@property (nonatomic, readonly) CGRect trimmngRect;
- (void)resetPosition;
@end
@hirokim
hirokim / LineBrush.m
Last active August 29, 2015 14:11
線を描画するときにブラシ効果
- (void)drawLine:(UIBezierPath*)path
{
// 非表示の描画領域を生成
UIGraphicsBeginImageContextWithOptions(self.canvas.frame.size, NO, 0.0);
// 描画領域に、前回までに描画した画像を、描画
[lastDrawImage drawAtPoint:CGPointZero];
// ブラシを指定して色をセット
UIColor *brushPattern = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"mask"]];
@hirokim
hirokim / gist:41b08063e09f8db829b2
Created October 31, 2014 07:41
使われてないリソース検索(Android)
java -jar AndroidUnusedResources1.6.2.jar
@hirokim
hirokim / git command
Last active August 29, 2015 14:07
忘れがちなGitコマンド
設定確認
$ git config -l
リモート登録
$ git remote add origin REMOTE_URL
リモート変更
$ git remote set-url origin git@git.example.com:foo/bar.git
リモートのタグの削除
@hirokim
hirokim / NetworkConection.cs
Last active December 17, 2015 04:38
unityの通信処理
public class NetworkConection : MonoBehaviour {
private const string imageParamKey = "IMAGE_FILE";
private const string imageMimeType = "image/png";
public void SendAsyncTextRequest (string url, POSTParameter paramObj, Action<string, string> completed) {
StartCoroutine(RequestText(url, paramObj, (www)=> {
if (!string.IsNullOrEmpty(www.error)) {