Skip to content

Instantly share code, notes, and snippets.

View wbspry's full-sized avatar

wbspry wbspry

View GitHub Profile
@wbspry
wbspry / getMemoryString
Created February 28, 2017 06:22
Androidのメモリ情報を取得し文字列にする
@NonNull
private String getMemoryString() {
int memoryClass = ((ActivityManager) getSystemService(ACTIVITY_SERVICE)).getMemoryClass();
int largeMemoryClass = ((ActivityManager) getSystemService(ACTIVITY_SERVICE)).getLargeMemoryClass();
// メモリ情報を取得
ActivityManager activityManager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
public class MultiLineSwitchPreference extends SwitchPreference {
public MultiLineSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public MultiLineSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
System.out.println("test");
@wbspry
wbspry / ChatRoom.java
Created August 11, 2014 03:09
Playframework付属のサンプル'websocket-chat'を見てみる(4/4) ref: http://qiita.com/yyyske/items/a6f5090f555038d6ff01
package models;
import play.mvc.*;
import play.libs.*;
import play.libs.F.*;
import scala.concurrent.Await;
import scala.concurrent.duration.Duration;
import akka.actor.*;
import static akka.pattern.Patterns.ask;
@wbspry
wbspry / Application.java
Created August 8, 2014 10:22
Playframework付属のサンプル'websocket-chat'を見てみる(3/4) ref: http://qiita.com/yyyske/items/87c49e925237a208373e
public static WebSocket<JsonNode> chat(final String username) {
return new WebSocket<JsonNode>() {
// Called when the Websocket Handshake is done.
public void onReady(WebSocket.In<JsonNode> in, WebSocket.Out<JsonNode> out){
// Join the chat room.
try {
ChatRoom.join(username, in, out);
} catch (Exception ex) {
@wbspry
wbspry / Application.java
Created August 7, 2014 08:56
Playframework付属のサンプル'websocket-chat'を見てみる(2/4) ref: http://qiita.com/yyyske/items/0d00e5e352b7078a501e
public static WebSocket<JsonNode> chat(final String username) {
return new WebSocket<JsonNode>() {
// Called when the Websocket Handshake is done.
public void onReady(WebSocket.In<JsonNode> in, WebSocket.Out<JsonNode> out){
// Join the chat room.
try {
ChatRoom.join(username, in, out);
} catch (Exception ex) {
@wbspry
wbspry / Application.java
Created August 6, 2014 09:52
Playframework付属のサンプル'websocket-chat'を見てみる(1/4) ref: http://qiita.com/yyyske/items/d9e3cf69f7a6f5fb732b
public static Result chatRoom(String username) {
if(username == null || username.trim().equals("")) {
flash("error", "Please choose a valid username.");
return redirect(routes.Application.index());
}
return ok(chatRoom.render(username));
}
package references;
import java.lang.ref.*;
public class Main {
public static void main(String[] args) {
Sheryl strongRef = new Sheryl();//①
WeakReference<Sheryl> weakRef = new WeakReference<Sheryl>(strongRef);//②
@wbspry
wbspry / .zshrc
Created July 22, 2014 09:04
herokuで詰まったところいろいろ ref: http://qiita.com/yyyske/items/e0c2bb615daa323cfd90
export HEROKU_API_KEY=xxxxxxxxxxxxxx
NSLog(@"Hello World");