Skip to content

Instantly share code, notes, and snippets.

View ozodrukh's full-sized avatar
🎃
woah, how close was that?

Ozodrukh ozodrukh

🎃
woah, how close was that?
View GitHub Profile
@ozodrukh
ozodrukh / HeaderDecor.java
Created June 21, 2016 07:41
Work in progress RecyclerView decoration to pin header
@Beta
private class HeaderDecor extends RecyclerView.ItemDecoration {
private RecyclerView.AdapterDataObserver adapterDataObserver;
private RecyclerView.ViewHolder headerViewHolder;
private int headerViewType;
private final Rect tmpBounds = new Rect();
@Override public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
if (headerViewHolder == null) {
headerViewHolder = obtainViewHolder(parent);
@ozodrukh
ozodrukh / player_get.py
Last active January 14, 2016 17:51
Player.uz script to grab and open direct link to serial or download sequentially by seasons and episodes
# coding: utf8
import re, json, bs4, requests, argparse, os, optparse
from urlparse import parse_qs, urlsplit, urlparse
ALL = -100
KEY_EPISODE_NUMBER = "episode"
KEY_EPISODE_SEASON = "season"
KEY_EPISODE_FILE = "file"
#ifndef __JniWrapper_h__
#define __JniWrapper_h__
#include <jni.h>
#include <string>
#include <exception>
//#include <boost/noncopyable.hpp>
namespace Android
package spoon.test;
import spoon.reflect.declaration.*;
import java.util.ArrayList;
import java.util.IntSummaryStatistics;
import java.util.TreeSet;
import java.util.function.Consumer;
import java.util.function.ToIntFunction;
@ozodrukh
ozodrukh / DrawablesCompat.java
Created April 11, 2015 12:06
Android Drawable loader alternative
package codetail.project.watchme.common.drawables;
import android.annotation.TargetApi;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.BitmapFactory;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
@ozodrukh
ozodrukh / FileUtils.java
Created April 9, 2015 17:46
Some useful file utility methods
public static String humanReadableByteCount(long bytes, boolean si) {
int unit = si ? 1000 : 1024;
if (bytes < unit) return bytes + " B";
int exp = (int) (Math.log(bytes) / Math.log(unit));
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
}
@ozodrukh
ozodrukh / LocaleUtils.java
Last active August 29, 2015 14:18
LocaleUtils change application & system locale of resources on the fly
package uz.uza.news.utils;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import java.util.Locale;
public final class LocaleUtils {
@ozodrukh
ozodrukh / app_build.gradle
Last active August 29, 2015 14:18
[Gradle] Add square dependecies
//usage in modules just add
dependencies {
addSquareUpArtifacts ":app", 'retrofit', '1.9.0', 'okhttp', '2.3.0'
}
package com.pixite.fragment.widget;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.view.Gravity;
@ozodrukh
ozodrukh / Fragment.java
Created January 6, 2015 18:23
Fragment Circular Reveal animation
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateInterpolator;