Skip to content

Instantly share code, notes, and snippets.

View shikajiro's full-sized avatar

shikajiro shikajiro

View GitHub Profile
curl --header "Authorization: key=<server key>" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"<registration id>\"],\"data\":{\"message\":\"Hello\"}}"
@shikajiro
shikajiro / file0.java
Created August 13, 2014 16:35
Androidでのテストで色々悩んだ結果robotiumになった件 ref: http://qiita.com/shikajiro@github/items/d28bf5eb4c9268f81131
public void testSayHello() {
//このclickで画面遷移すると仮定する。
onView(withId(R.id.greet_button))
.perform(click());
//遷移後の画面に"Hello Steve!"が表示されるが、このassertはOKだったりNGだったりする。
onView(withText("Hello Steve!"))
.check(matches(isDisplayed()));
}
@shikajiro
shikajiro / build.gradle
Created December 9, 2014 08:10
Deploygateにgradleからアップロードする際に、メッセージをコンソールから指定する ref: http://qiita.com/shikajiro/items/7a4f26cb4c5fff8b2a93
deploygate {
userName = "shikajiro"
token = "hogehoge"
apks {
release {
sourceFile = file("build/outputs/apk/app-release.apk")
message = deploygateMsg
}
debug {
@shikajiro
shikajiro / MainActivity.java
Last active August 29, 2015 14:15
AndroidからOAuth2を使ってGoogle SpreadSheetへアクセスする方法 ref: http://qiita.com/shikajiro/items/63200af32b280be48bb5
//※ここにユーザーアカウント選択画面があると素敵だと思います。
//oauth tokenの取得
String token;
try {
token = GoogleAuthUtil.getToken(this, "shikajiro@gmail.com", "oauth2:https://spreadsheets.google.com/feeds");
Log.i("TAG", token);
} catch (UserRecoverableAuthException e) {
//最初のアクセスの場合かならずここに来る。
//ユーザーに承認を求める画面が表示される。
@shikajiro
shikajiro / build.gradle
Created February 16, 2015 15:09
Android新規プロジェクト時のbuild.gradleのテンプレート
//build.gradleのテンプレート
/*root*/
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url 'http://download.crashlytics.com/maven' }
}
#macとRaspberryPiを有線LANで直接繋いだ時に、RaspPi側のipaddressを知るのに素敵なコマンド
sudo tcpdump | grep "192.168.2.*"
weight = 9.5 # your dog weight
isCastration = True # your dog coefficient
coefficient = 1.8
if isCastration:
coefficient = 1.6
calorie = coefficient * (30 * weight + 70)
print calorie
* ルール
** ゲームの目的
** ゲームの内容物
*** 十二支カード 12枚
カード右上に表示されている数字が獲得ポイント。カード下部には、十二支フェイズで発動する特殊能力が表示されています。
*** 戦闘カード 44枚
4種類の色(赤、青、黄、緑)事に、0から11の数値が表示された計11枚の戦闘カードがあります。戦闘カードに表示されている数値は、強さを表します。
*** コマ 4個
各色1個。
#ユーザーがユーザーにタグ付をするサービス
#ユーザーモデル
User = sequelize.define 'User'
id:
type: Sequelize.INTEGER
primaryKey: true
autoIncrement: true
socialId: Sequelize.TEXT # facebookなどの外部ソーシャルネットワークのID
name: Sequelize.STRING # 名前
@shikajiro
shikajiro / svg2png.groovy
Last active October 27, 2015 07:07
Android用のpng画像生成スクリプト。svg画像をmdpi, hdpi, xhdpi, xxhdpi, xxxhdpi毎のpng画像に変換する。要Inkscape
/* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,