Skip to content

Instantly share code, notes, and snippets.

@Hackforid
Hackforid / IndexSideBar.java
Created August 7, 2016 04:46
IndexSideBar
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
/**
// format name
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
if (output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
def outputName = "Danjuan-" + versionName + "-" + output.outputFile.name
outputName = outputName.replace(' ', '')
def file = output.outputFile
output.outputFile = new File(file.parent, outputName)
}
}
@Hackforid
Hackforid / 0_reuse_code.js
Created April 14, 2016 06:35
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
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="gentoo"
# Example aliases
@Hackforid
Hackforid / DividerItemDecoration.java
Created December 30, 2015 09:22 — forked from lapastillaroja/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@Hackforid
Hackforid / .gitignore
Created December 16, 2015 06:14
gitignore for Android
# IntelliJ IDEA
.idea
*.iml
*.ipr
*.iws
# Gradle
.gradle
gradlew.bat
build
@Hackforid
Hackforid / base.py
Created May 13, 2015 08:25
Sqlalchemy use scoped_session in Tornado
# -*- coding: utf-8 -*-
import store
from tools.tor import ThreadRequestContext
class BaseHandler(RequestHandler):
def prepare(self):
store.db()
@Hackforid
Hackforid / gist:5760951e1fd6d5cd9e85
Created May 13, 2015 03:08
ThreadRequestContext
# -*- coding: utf-8 -*-
import threading
class ThreadRequestContext(object):
"""A context manager that saves some per-thread state globally.
Intended for use with Tornado's StackContext.
@Hackforid
Hackforid / gist:e38740495c5e8ddd43c9
Created May 12, 2015 12:48
Sqlalchemy批量插入
conn.execute(MyTable.insert(), [{'color': 'blue'},
{'color': 'red'},
{'color': 'green'}])
@Hackforid
Hackforid / gist:3b6792333299f47e70b6
Created April 21, 2015 07:19
Stetho Okhttp Picasso
public class App extends Application {
private static final String PICASSO_CACHE = "picasso-cache";
private static final long PICASSO_CACHE_SIZE = 100 * 1024 * 1024;
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {