Skip to content

Instantly share code, notes, and snippets.

View oksep's full-sized avatar
🎯
Cogito, ergo sum

Septenary oksep

🎯
Cogito, ergo sum
View GitHub Profile
@oksep
oksep / gist:6686194e0435f8cb71a7
Created August 27, 2015 10:06
Sqlite ,get table row count
private long getTableRowCount(String tableName) {
String sql = "select count(*) from " + tableName;
SQLiteStatement statement = db.compileStatement(sql);
return statement.simpleQueryForLong();
}
@oksep
oksep / GIF-Screencast-OSX.md
Last active August 29, 2015 14:25 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@oksep
oksep / GsonRequest.java
Last active August 31, 2015 08:34 — forked from ficusk/GsonRequest.java
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
@oksep
oksep / Readme.md
Last active September 21, 2015 02:00 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@oksep
oksep / README.md
Created September 23, 2015 02:05 — forked from gabrielemariotti/README.md
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@oksep
oksep / gist:106f67be34bc6243eb59
Created October 8, 2015 01:58
Custom signingConfigs from file
signingConfigs {
debug {
// No debug config
}
release {
def filePrivateProperties = file("../releaseSigningConfig.properties")
if (filePrivateProperties.exists()) {
Properties propsPrivate = new Properties()
propsPrivate.load(new FileInputStream(filePrivateProperties))
@oksep
oksep / NinePatchImageUtil
Last active October 8, 2015 01:58
Decode a stream to ninePatchDrawable
/**
* input must be create by /bin/crunk
*/
public static Drawable getNinePatchDrawable(Context context, InputStream input) {
Bitmap ninePathBmp = null;
ninePathBmp = BitmapFactory.decodeStream(input);
if (ninePathBmp == null) {
return null;
}
byte[] chunk = ninePathBmp.getNinePatchChunk();
# Theme itg.flat config
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - itg.flat/itg.dark.tmTheme",
"font_size": 16,
"ignored_packages":
[
"Markdown",
@oksep
oksep / gist:a7747de15000e31041fa
Created February 15, 2016 03:37
锚链接平滑滚动
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>锚链接平滑滚动</title>
<meta name="description" content="">
<meta name="keywords" content="">
<style type="text/css">
* {
@oksep
oksep / ShellUtils.java
Created February 15, 2016 06:21
ShellUtils
package com.example.hellojni;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
/**
* ShellUtils