Skip to content

Instantly share code, notes, and snippets.

Avatar
🎃
woah, how close was that?

Ozodrukh ozodrukh

🎃
woah, how close was that?
View GitHub Profile
@ozodrukh
ozodrukh / player_get.py
Last active Jan 14, 2016
Player.uz script to grab and open direct link to serial or download sequentially by seasons and episodes
View player_get.py
# 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"
View JNIWrapper.h
#ifndef __JniWrapper_h__
#define __JniWrapper_h__
#include <jni.h>
#include <string>
#include <exception>
//#include <boost/noncopyable.hpp>
namespace Android
View AdvancedIntStatistics.java
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 Apr 11, 2015
Android Drawable loader alternative
View DrawablesCompat.java
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 Apr 9, 2015
Some useful file utility methods
View FileUtils.java
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 Aug 29, 2015
LocaleUtils change application & system locale of resources on the fly
View LocaleUtils.java
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 Aug 29, 2015
[Gradle] Add square dependecies
View app_build.gradle
//usage in modules just add
dependencies {
addSquareUpArtifacts ":app", 'retrofit', '1.9.0', 'okhttp', '2.3.0'
}
View RevealDrawable.java
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 Jan 6, 2015
Fragment Circular Reveal animation
View Fragment.java
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;
@ozodrukh
ozodrukh / HideExtraOnScroll.java
Created Nov 16, 2014
Show/Hide extra objects when scrolling
View HideExtraOnScroll.java
public static class HideExtraOnScroll extends RecyclerView.OnScrollListener{
final static Interpolator ACCELERATE = new AccelerateInterpolator();
final static Interpolator DECELERATE = new DecelerateInterpolator();
WeakReference<View> mTarget;
HideExtraOnScrollHelper mScrollHelper;
boolean isExtraObjectsOutside;