Skip to content

Instantly share code, notes, and snippets.

View ddqd's full-sized avatar
🐕
🐱

Dmitry ddqd

🐕
🐱
View GitHub Profile
public class ColorGenerator {
public static ColorGenerator DEFAULT;
public static ColorGenerator MATERIAL;
static {
DEFAULT = create(Arrays.asList(
0xfff16364,
0xfff58559,
@ddqd
ddqd / elevation_compat.xml
Created December 10, 2015 22:24
Toolbar shadow in coordinatorlayout for pre lollipop devices
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="@android:color/transparent"
android:startColor="#50000000" />
</shape>
@ddqd
ddqd / main.xml
Created September 2, 2015 13:56
toolbar with custom layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.Toolbar
@ddqd
ddqd / DigestAuthenticator
Created December 3, 2014 13:37
OkHttp DigestAuthenticator
import android.util.Log;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import org.apache.http.auth.AuthenticationException;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.MalformedChallengeException;
import org.apache.http.impl.auth.DigestScheme;
import org.apache.http.message.BasicHeader;
-module(urljoin).
-compile([export_all]).
s() ->
lists:flatten(urljoin([{foo, "bar"}, {baz, "quux"}, {fubar, "ok"}])).
%%iolist_to_binary(urljoin([{foo, "bar"}, {baz, "quux"}, {fubar, "ok"}])).
urljoin([{K, V}]) ->
[atom_to_list(K), "=", V];
function s(e){return e=!e&&e!=0?'':e+''}
var CoreApi = function(){
var host = "host"
var post = function (path, params, callback) {
request(host, 'POST', params, callback)
}
var request = function (url, method, params, callback) {
var xhr = new XMLHttpRequest();
if(params == 'POST'){
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
---
config:
key: value
key2: value2
key3:
- one
- two
- three
key4:
key4_1: 41