Skip to content

Instantly share code, notes, and snippets.

View tyvsmith's full-sized avatar

Ty Smith tyvsmith

View GitHub Profile
@tyvsmith
tyvsmith / dex-count.sh
Created July 22, 2013 18:45
"`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH." Use this to keep track of methods and fields in your apk. They are both limited to 65536. Example use: $ source dex-count.sh; $ dex-field-count classes.dex; Original method scrip…
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)
@tyvsmith
tyvsmith / AsyncBusinesNoteStoreClient notebook list.java
Last active December 14, 2015 18:39
Listing notebooks using the AsynNoteStoreClient
//Creating the business note store makes network requests
//to validate the auth token for the business
mEvernoteSession.getClientFactory().createBusinessNoteStoreClient(
new OnClientCallback<AsyncBusinessNoteStoreClient>() {
@Override
public void onSuccess(final AsyncBusinessNoteStoreClient client) {
//This is running in the UI Thread
client.listNotebooks(new OnClientCallback<List<Notebook>() {
@Override
@tyvsmith
tyvsmith / test
Created April 11, 2012 01:16
test
test
@tyvsmith
tyvsmith / Setting.rb
Created June 5, 2011 20:42
Dynamic changes to schedule.rb for Whenever gem
class Setting < ActiveRecord::Base
validates_uniqueness_of :var
validates_presence_of :value
after_save :send_cron_later
#Setting.for(:display).set=(value)
def self.for(var)
find_or_create_by_var(var)
@tyvsmith
tyvsmith / AndroidManifest.xml
Created May 24, 2011 22:58
RESTclient-Android Blog entries
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".ui.Main" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".receiver.BootReceiver">