Skip to content

Instantly share code, notes, and snippets.

@myaaaaa-chan
myaaaaa-chan / intall-httpd-playbook.yml
Created October 16, 2013 10:13
ansibleでApache httpdをソースからコンパイルしてインストールするPlaybookメモ ref: http://qiita.com/nyan_mofmof/items/a9740ba66f9a5c50594b
- hosts: [web-server]
vars:
src_dir: '/usr/local/src'
pcre_version: "8.33"
pcre_name: "pcre-$pcre_version"
pcre_dl_url: "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$pcre_name.tar.gz"
httpd_version: "2.4.6"
httpd_name: "httpd-$httpd_version"
@myaaaaa-chan
myaaaaa-chan / VolleyGsonRequest.java
Created August 1, 2013 07:07
Volley Gson Request Wrapper
import java.util.HashMap;
import android.app.ProgressDialog;
import com.android.volley.Request.Method;
import com.android.volley.RequestQueue;
import com.android.volley.VolleyError;
/**
* The Class VolleyGsonRequest.
@myaaaaa-chan
myaaaaa-chan / GsonRequest
Created July 4, 2013 05:28
Volley adapter for JSON requests with POST method that will be parsed into Java objects by Gson @see https://gist.github.com/ficusk/5474673
package jp.i_dig.community.util;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
@myaaaaa-chan
myaaaaa-chan / file0.m
Created June 4, 2013 11:49
UINavigationBarの戻るボタン等をカスタマイズする ref: http://qiita.com/items/31d942792a80c047473d
// ノーマル
UIImage *imageNormal = [[UIImage imageNamed:@"normal"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 6)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:imageNormal forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// ハイライト
UIImage *imageHighlight = [[UIImage imageNamed:@"highlight"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 6)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:imageHighlight forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
@myaaaaa-chan
myaaaaa-chan / file0.m
Created May 13, 2013 02:14
iOSでAndroidのToastっぽいものを表示する ref: http://qiita.com/items/d01c5f3dbc7673da4d34
[self.view makeToast:@"メッセージ" duration:3.0 position:@"bottom"];
@myaaaaa-chan
myaaaaa-chan / file0.m
Created May 10, 2013 12:14
アプリケーションがバックグラウンドから復帰するときに任意の処理を呼び出す ref: http://qiita.com/items/b7f82079d3bb35dba68e
UIApplication *application = [UIApplication sharedApplication];
// アクティブになったときに通知されるように登録する
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(hoge) name:UIApplicationDidBecomeActiveNotification object:application];
@myaaaaa-chan
myaaaaa-chan / file0.m
Created May 10, 2013 08:26
UITableViewCellの背景色を変える ref: http://qiita.com/items/f13ef0d2266d1cf6c812
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = UIColor colorWithHue:0.61 saturation:0.09 brightness:0.99 alpha:1.0];
}
@myaaaaa-chan
myaaaaa-chan / MyUILabel.m
Created May 10, 2013 02:02
UILabelを角丸にする&パディングを設定する方法 ref: http://qiita.com/items/cb168bd041c77ec54b0a
- (void)drawTextInRect:(CGRect)rect
{
// top, left, bottom, right
UIEdgeInsets insets = {0, 20, 0, 20};
return [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
}
@myaaaaa-chan
myaaaaa-chan / file0.m
Created May 9, 2013 09:51
SDWebImageで画像をダウンロードする ref: http://qiita.com/items/1198abc5351ca57a552c
#import "UIImageView+WebCache.h"
- (void)viewDidLoad
{
NSURL url = [NSURL URLWithString:@"http://hogehoge.com/hoge.png"];
[imageView setImageWithURL:url placeholderImage:nil options:SDWebImageCacheMemoryOnly];
}
@myaaaaa-chan
myaaaaa-chan / file0.m
Created May 9, 2013 07:18
xcode4で作ったplistのArrayを読み込む ref: http://qiita.com/items/7f35e47133ceab36dcdc
NSString *path = [[NSBundle mainBundle] pathForResource:@"config" ofType:@"plist"];
NSDictionary *propDictionary = [NSDictionary dictionaryWithContentsOfFile:path];
NSArray *array = [NSArray arrayWithArray:[propDictionary objectForKey:@"key"]];