Skip to content

Instantly share code, notes, and snippets.

View ochim's full-sized avatar

munehiro ochi ochim

View GitHub Profile
@ochim
ochim / gist:ebbd87b4411da3e74f42261326fc3a3c
Last active April 28, 2016 08:25
[iOS]アプリアイコンのバッジを更新する

スニペット 抜粋先

- (void)updateIconBadgeNumber:(NSInteger)iconBadgeNumber {
    UIApplication *application = [UIApplication sharedApplication];
    if (floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_8_0) {
        // iOS8 and later
        if ([application currentUserNotificationSettings].types & UIUserNotificationTypeBadge) {
            /*
             バッチの更新処理
 iOS8系の場合は[[UIApplication sharedApplication] currentUserNotificationSettings]で
@ochim
ochim / git_tips_1.md
Created May 17, 2016 10:10
[git]リモートから特定のブランチを指定してcloneする
@ochim
ochim / android_CurrentDate.md
Created May 17, 2016 10:14
[Android] 現在日時の取得方法

概要

端末の現在日時を「yyyy/MM/dd HH:mm:ss」形式の文字列で取得する。

サンプルコード

/**
 * 現在日時をyyyy/MM/dd HH:mm:ss形式で取得する.<br>
 */
public static String getNowDate(){
 final DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
@ochim
ochim / prime.rb
Created May 22, 2016 12:19
素数判定
def isPrime(i)
# 1は素数ではない
return false if i == 1
# 2は素数
return true if i == 2
primeNumbers = [2]
judge = true
@ochim
ochim / post_request.php
Created June 10, 2016 10:13
PHPでPOSTリクエスト
PHP でPOSTリクエスト
```
<?php
//
$baseurl = "https://xxx.co.jp";
$method = "POST";
$path = "/user/login";
//header
@ochim
ochim / update_SSL.md
Last active October 10, 2016 14:17
SSL証明書更新
@ochim
ochim / file0.txt
Created October 28, 2016 15:08
[Android]gradlew実行でbash\r: No such file or directory ref: http://qiita.com/ochim/items/228f8dc89f392a3bea84
>./gradlew clean build
/usr/bin/env: bash\r: No such file or directory
@ochim
ochim / file0.txt
Created November 2, 2016 07:43
[java]Mapクラスのオブジェクトの中身を全て確認するコード ref: http://qiita.com/ochim/items/bfb9f903026a1402c1a1
public static void main(String arg[]) {
Map<String, String> map = new HashMap<>();
map.put("key1", "val1");
map.put("key2", "val2");
for (String key : map.keySet()) {
System.out.println(key + ":" + map.get(key));
}
}
@ochim
ochim / java0.md
Created December 15, 2016 06:58
[java]配列オブジェクトからArrayListへ変換

配列オブジェクトからArrayListへ変換をしたいときに、いちいちfor文とかを使わない方法

public class AAAA {
	public static void main(String[] args) throws UnsupportedEncodingException {

		String [] str = { "ichika","kaito","kanna","tetsurou","mio","remmon"};
		ArrayList al = new ArrayList(Arrays.asList(str));

 Iterator it = al.iterator();
@ochim
ochim / gist:16cf7443fbaf25b541d1c2f5387fe30d
Created December 20, 2016 10:34
[iOS]プッシュ通知許可のダイアログを意図的に表示
アプリをアンインストールして1日以上経過した状態を作りだすのが重要みたい。再起動は面倒だけど省くと上手くいかない。
1.デバイスの時刻を自動設定から手動に変更
2.アプリをアンインストール
3.デバイスを再起動
4.iPhone の時刻を1日以上未来に手動で変更
5.デバイスを再起動
6.アプリを再インストール
7.プッシュ通知許可のダイアログが表示