Skip to content

Instantly share code, notes, and snippets.

View thuytrinh's full-sized avatar
💭
${null}

Thuý thuytrinh

💭
${null}
  • Frankfurt, Germany
  • 17:09 (UTC +02:00)
View GitHub Profile
package no.finn.android.contentprovider;
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@Aracem
Aracem / styles.xml
Last active July 11, 2017 15:48
Material Text Styles supported for all version with Appcompat + Calligraphy Library ( https://github.com/chrisjenx/Calligraphy ) Material Design recomendations http://www.google.com/design/spec/style/typography.html#typography-roboto-noto Remember to add the fonts to your source/fonts folder
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- TextView Empty Base-->
<style name="TextViewBase" parent="android:TextAppearance.Holo.Widget.TextView"/>
<!-- ActionBar Title -->
<style name="CustomActionBarTitleBase" parent="TextAppearance.AppCompat.Widget.ActionBar.Title"/>
<!-- Text Views Default Base -->
@LordRaydenMK
LordRaydenMK / FusedLocationProviderApi
Last active September 11, 2017 11:46
Using the FusedLocationProviderApi to request location updates
public class MainActivity extends Activity implements LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private LocationRequest mLocationRequest;
private GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mLocationRequest = LocationRequest.create();
@mattdenner
mattdenner / gist:dd4cfde3f355ff6b7be8
Last active May 18, 2016 18:52
From imperative to functional: functors, applicatives, monads & other link bait

I’ve been writing a load of Swift code recently for work and this has lead me into the world of typed functional programming. The app needs to build certain objects from a comma separated string, and this lead me to applicative functors, which lead me to brain ache but enlightenment. So here’s my thoughts on how I got to understand these a little better.

All of the code is in Swift, so less clean than Haskell. I’m also only a about 6 weeks into Swift development so I probably haven’t got all of the idioms right. I’ve avoided the optional shorthand wherever possible here, preferring Optional<Type> over Type? because I believe the latter is hiding something that helps understand this code in the context of other generic classes.

It’s also long! I think it’s probably the longest blog post I’ve ever written but I found it interesting and useful, for myself, to write. If you’re one of those people who skip to the end of a book to find out whodunit then I’ve included

@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@mohlendo
mohlendo / ReorderRecyclerView.java
Created November 26, 2014 14:05
A RecylcerView that can be reordered with drag&drop. Heavily inspired by https://www.youtube.com/watch?v=_BZIvjMgH-Q A complete example can be found here: https://github.com/mohlendo/ReorderRecyclerView
/*
* Copyright (C) 2014 I.C.N.H GmbH
*
* 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
@chrisdone
chrisdone / typing.md
Last active March 22, 2024 23:24
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

package org.paulbetts.shroom.core;
import android.os.AsyncTask;
import com.squareup.okhttp.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
@Grab(group = 'com.squareup.retrofit', module = 'retrofit', version = '1.6.1')
import retrofit.RestAdapter
import retrofit.http.GET
import retrofit.http.Query
interface WeatherService {
@GET('/forecast/webservice/json/v1')
Map find(@Query('city') String city)
}
@dmarcato
dmarcato / strip_play_services.gradle
Last active December 21, 2022 10:10
Gradle task to strip unused packages on Google Play Services library
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')