This file contains hidden or 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
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }} | |
{{ define "upstream" }} | |
{{ if .Address }} | |
{{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}} | |
{{ if and .Container.Node.ID .Address.HostPort }} | |
# {{ .Container.Node.Name }}/{{ .Container.Name }} | |
server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }}; | |
{{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}} | |
{{ else if .Network }} |
This file contains hidden or 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.squareup.moshi.JsonReader; | |
import com.squareup.moshi.JsonWriter; | |
import okio.Buffer; | |
import okio.BufferedSink; | |
import java.io.IOException; | |
public final class MoshiHelper { | |
public static void dump(JsonReader reader, BufferedSink sink) throws IOException { |
This file contains hidden or 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
package moe.banana.jsonapi2.issue5; | |
import moe.banana.jsonapi2.JsonApi; | |
import moe.banana.jsonapi2.Resource; | |
@JsonApi(type = "accessToken") // `access-tokens` is recommended by JSON API specification | |
public class AccessToken extends Resource { | |
public String tokenType; | |
public String value; | |
} |
This file contains hidden or 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
<android.support.v4.widget.SwipeRefreshLayout | |
android:id="@+id/refreshLayout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.v4.widget.NestedScrollView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<LinearLayout |
This file contains hidden or 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 org.json.JSONObject; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import rx.Observable; | |
import rx.Scheduler; |
This file contains hidden or 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 AVUpdateUtils { | |
public static final long RESULT_OK = 0L; | |
public static final long RESULT_CANCEL = 1L; | |
public static final long RESULT_INSTALLING = 2L; | |
private static long downloadInBackground(Context context, String url, File file) { | |
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); | |
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI); | |
request.setAllowedOverRoaming(false); |
This file contains hidden or 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
// In editor console | |
Jupyter.editor.config.update({Editor: {codemirror_options: { indentUnit:2 }}}) | |
// In notebook console | |
Jupyter.notebook.get_selected_cell().config.update({CodeCell: {cm_options: { indentUnit:2 }}}) |
This file contains hidden or 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
#!/bin/sh | |
# Examples: | |
# ./image64.sh myImage.png | |
# outputs: data:image/png;base64,xxxxx | |
# ./image64.sh myImage.png -img | |
# outputs: <img src="data:image/png;base64,xxxxx"> | |
append="" | |
if [[ "$1" == *.gif ]]; then |
This file contains hidden or 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
@font-face { | |
font-family: "Kagami Serif"; | |
src: local("Liberation Serif"), | |
local("Times New Roman"), | |
local("Times"); | |
} | |
@font-face { | |
font-family: "Kagami Songti SC"; | |
src: local("Songti SC Regular"), local(STSongti-SC-Regular), // OS X 10.8 |
This file contains hidden or 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
# utility | |
logfile = None | |
def debug(*objects): | |
print(*objects) | |
if logfile: | |
print(*objects, file=logfile, flush=True) | |
def format_hex(bs, delim=''): |