Skip to content

Instantly share code, notes, and snippets.

like achenglike

Block or report user

Report or block achenglike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
achenglike / 修改TabLayout Indicator的宽度
Created Jun 7, 2018 — forked from Runly/修改TabLayout Indicator的宽度
change TabLayout Indicator width 修改TabLayout Indicator的宽度
View 修改TabLayout Indicator的宽度
* 通过反射修改TabLayout Indicator的宽度(仅在Android 4.2及以上生效)
private void setUpIndicatorWidth(TabLayout tabLayout) {
Class<?> tabLayoutClass = tabLayout.getClass();
Field tabStrip = null;
try {
tabStrip = tabLayoutClass.getDeclaredField("mTabStrip");
} catch (NoSuchFieldException e) {
achenglike / ContextUtil
Created Apr 25, 2018
get activity from context
View ContextUtil
* get Activity from context
* @param context
* @return
public static Activity getActivity(Context context) {
while (context instanceof ContextWrapper) {
if (context instanceof Activity) {
return (Activity)context;
achenglike /
Created Nov 21, 2017 — forked from silvestrpredko/
Append parameters to POST in Intercept(OkHttp)
* @param parameter - this is string that contains parameters for Http POST
* @param request - old Request
* @return - new {@link Request} with additional parameters
* */
public static Request interceptRequest(@NotNull Request request, @NotNull String parameter)
throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
achenglike /
Created Oct 14, 2016 — forked from isaacs/
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
You can’t perform that action at this time.