Author: Michael Zeng
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
history = [] | |
while history != [0, 0, 0, 0, 1] do | |
n = rand(2) | |
history.push(n) | |
history.shift if history.size > 5 | |
puts n == 0 ? 'ズン' : 'ドコ' | |
end | |
puts 'キ・ヨ・シ!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You can place it in the root build.gradle | |
allprojects { | |
tasks.withType(JavaForkOptions) { | |
// Forked processes like GradleWorkerMain for tests won't steal focus! | |
jvmArgs '-Djava.awt.headless=true' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Permissionのファイルは | |
/data/system/users/{userId}/runtime-permissions.xml | |
ここにこういうのが入ってる | |
```runtime-permissions.xml | |
<?xml version='1.0' encoding='utf-8' standalone='yes' ?> | |
<runtime-permissions> | |
<pkg name="com.android.launcher"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ColoredSnackBar { | |
private static final int red = 0xfff44336; | |
private static final int green = 0xff4caf50; | |
private static final int blue = 0xff2195f3; | |
private static final int orange = 0xffffc107; | |
private static View getSnackBarLayout(Snackbar snackbar) { | |
if (snackbar != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.*; | |
import com.squareup.picasso.Transformation; | |
/** | |
* Transforms an image into a circle representation. Such as a avatar. | |
*/ | |
public class CircularTransformation implements Transformation | |
{ | |
int radius = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2014 The Android Open Source Project | |
* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.auto.value.AutoValue; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.Target; | |
import static java.lang.annotation.ElementType.TYPE; | |
import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
/** | |
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization. | |
* <p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); | |
//Title and subtitle | |
toolbar.setTitle("MY toolbar"); | |
toolbar.setSubtitle("Subtitle"); | |
//Menu | |
toolbar.inflateMenu(R.menu.toolbar_menu); | |
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { |
NewerOlder