Skip to content

Instantly share code, notes, and snippets.

View u1aryz's full-sized avatar
Unemployed

u1aryz u1aryz

Unemployed
View GitHub Profile

PR: konifar/droidkaigi2016#108

もとの問題

アプリを起動(MainActivity)して任意のセッション詳細(SessionDetailActivity)を開いてSessionの状態を変更して戻る。このときMainActivityが破棄-再生成されていた場合にクラッシュする

構造的な問題

MainActivity-SessionsFragment-ViewPager-SessionsTabFragmentの構造のなかで、それぞれのコンポーネント間で直接onActivityResult()を呼び出して伝搬する方法を取っていた。

diff -Nur support-v4-22.2.1/android/support/v4/animation/AnimatorCompatHelper.java support-v4-23.0.0/android/support/v4/animation/AnimatorCompatHelper.java
--- support-v4-22.2.1/android/support/v4/animation/AnimatorCompatHelper.java 2015-07-17 03:08:30.000000000 +0900
+++ support-v4-23.0.0/android/support/v4/animation/AnimatorCompatHelper.java 2015-06-23 08:43:44.000000000 +0900
@@ -17,6 +17,7 @@
package android.support.v4.animation;
import android.os.Build;
+import android.view.View;
abstract public class AnimatorCompatHelper {
@hnakamur
hnakamur / main.go
Last active February 12, 2023 00:15
A go example to stop a worker goroutine when Ctrl-C is pressed (MIT License)
package main
import (
"fmt"
"os"
"os/signal"
"time"
"golang.org/x/net/context"
)
@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@hogedigo
hogedigo / hello.go
Last active August 29, 2015 13:57
GAE/Goでmartini
package hello
import (
"github.com/codegangsta/martini"
"net/http"
)
func init() {
m := martini.Classic()
m.Get("/hello/:name", func(params martini.Params, w http.ResponseWriter) string {
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@bagpack
bagpack / gist:7839754
Last active September 5, 2017 05:52
run script with android plugin. launching application after gradle install${buildType}.
android.buildTypes.all{ theBuildType ->
def buildType = theBuildType.name
def taskName = "run${theBuildType.name.capitalize()}"
task ("${taskName}") {
dependsOn "install${theBuildType.name.capitalize()}"
doLast {
def xml = new File(buildDir.toString() + "/manifests/${buildType}/AndroidManifest.xml")
def manifest = new XmlParser(false,true).parseText(xml.getText())
def ns = new groovy.xml.Namespace("http://schemas.android.com/apk/res/android", "ns")
@narusemotoki
narusemotoki / Main.java
Last active December 14, 2015 02:09
JavaのgetCanonicalName()、getName()、getSimpleName()が外部クラス、外部クラス内匿名クラス、内部クラス、内部クラス内匿名クラスでそれぞれどういう値を返すのかを調べました。
package ho.ge;
/*
結果
Main
Canonical: ho.ge.Main
Name: ho.ge.Main
Simple: Main
-----
Annoymous
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {