Skip to content

Instantly share code, notes, and snippets.

View eneim's full-sized avatar
😀
the simple, the best

Nam Nguyen eneim

😀
the simple, the best
View GitHub Profile
@eneim
eneim / GistList!.md
Created April 19, 2015 23:24
Try GistList for iOS! http://gistlist.io/

##alt text GistList: TODO for coders alt text

@eneim
eneim / NavigationDrawerFragment.java
Created May 12, 2015 01:20
NavigationDrawerFragment without glitch
package im.ene.lab.resume.fragments;
import im.ene.lab.resume.R;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
@eneim
eneim / CustomRadioButton.java
Last active August 29, 2015 14:21
A Fix for Custom RadioButton in Android version lower than 17 (JB-MR1))
package im.ene.lab.zzz.widgets;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.RadioButton;
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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
@eneim
eneim / DateTimeFormatterSample.java
Last active August 29, 2015 14:25 — forked from tokuhirom/DateTimeFormatterSample.java
Java 8 Date And Time API - Sample code.
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
public class DateTimeFormatterSample {
public static void main(String[] args) {
String[][] patterns = new String[][]{
new String[]{"G", "appendText(ChronoField.ERA,"},
@eneim
eneim / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@eneim
eneim / MyApplication.java
Created July 24, 2015 03:13
Sample Application class
package com.example.app;
import android.app.Application;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
AndroidThreeTen.init(this); // init the lib here
@eneim
eneim / SomeFragment.java
Created August 7, 2015 07:29
Sample code
public class HomeFragment extends Fragment {
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
private String urlCitiesObj = "url";
private static String TAG = HomeFragment.class.getSimpleName();
@eneim
eneim / Connectivity.java
Created November 17, 2015 14:42 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil