Skip to content

Instantly share code, notes, and snippets.

@lidemin
lidemin / 0_reuse_code.js
Created February 7, 2014 05:39
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
#!/usr/bin/perl
#
# Pre-commit hook for running checkstyle on changed Java sources
#
# To use this you need:
# 1. checkstyle's jar file somewhere
# 2. a checkstyle XML check file somewhere
# 3. To configure git:
# * git config --add checkstyle.jar <location of jar>
# * git config --add checkstyle.checkfile <location of checkfile>
@lidemin
lidemin / TestScrollableTextView
Created April 25, 2014 04:02
Android Scrollable TextView
tv.setMovementMethod(new ScrollingMovementMethod() );
@lidemin
lidemin / SelectableTextView.java
Created May 15, 2014 08:24
SelectableTextView
package com.damon.view;
import android.content.Context;
import android.graphics.Color;
import android.support.v4.view.GestureDetectorCompat;
import android.text.Spanned;
import android.text.style.BackgroundColorSpan;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
@lidemin
lidemin / HtmlManipulator.java
Created May 16, 2014 03:17
HtmlManipulator
package com.damon.utils;
/**
* Created by damon on 16/5/14.
*/
import java.util.HashMap;
import java.util.Map;
/**
@lidemin
lidemin / ConfigureLog4J.java
Created May 16, 2014 09:05
ConfigureLog4J
/**
* This class is used for configure Log4J for Android.
* Before configure log4j make sure your project has already included
* 'log4j' and 'de.mindpipe.android:android-logging-log4j:1.0.3'.
*
* Then in you app onCreate() function you can use this class to configure.
*
* ConfigureLog4J.configure();
*
* After this you can use :
@lidemin
lidemin / dex.sh
Created June 30, 2014 03:10 — forked from JakeWharton/dex.sh
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
package com.android.dex;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
public class Summary {
public static void main(String[] args) throws IOException {
package com.android.dex;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
public class Summary {
public static void main(String[] args) throws IOException {
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;