This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.trifork.example" | |
android:installLocation="auto" | |
android:versionName="@string/client_info" > | |
<!-- ... --> | |
<application | |
android:hardwareAccelerated="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if test $# -lt 1 ; then | |
echo "Usage: download_apk.sh <GooglePlayPackageName>" | |
exit 1 | |
fi | |
PACKAGE=$1 | |
APK_PATH=`adb shell pm list packages -f -3 | grep $PACKAGE | cut -d'=' -f 1 | cut -c9-` | |
echo "Pulling $APK_PATH from device" | |
echo `adb pull ${APK_PATH} ./${PACKAGE}.apk` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Name this file “colors.xml” --> | |
<!-- Then place it in your project's “res/values/” folder. --> | |
<!-- Created by Marcel Ulbrich --> | |
<!-- google.com/+MarcelUlbrich --> | |
<!-- Updated 2014-12-09 to reflect Google's latest changes --> | |
<color name="red_050">#FFEBEE</color> <!-- Use with black text --> | |
<color name="red_100">#FFCDD2</color> <!-- Use with black text --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make a custom Gson instance, with a custom TypeAdapter for each wrapper object. | |
// In this instance we only have RealmList<RealmInt> as a a wrapper for RealmList<Integer> | |
Type token = new TypeToken<RealmList<RealmInt>>(){}.getType(); | |
Gson gson = new GsonBuilder() | |
.setExclusionStrategies(new ExclusionStrategy() { | |
@Override | |
public boolean shouldSkipField(FieldAttributes f) { | |
return f.getDeclaringClass().equals(RealmObject.class); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GSON can parse the data. | |
// | |
// Deserialization: | |
// Note there is a bug in GSON 2.3.1 that can cause it to StackOverflow when working with RealmObjects. | |
// To work around this, use the ExclusionStrategy below or downgrade to 1.7.1 | |
// See more here: https://code.google.com/p/google-gson/issues/detail?id=440 | |
// | |
// Serialization: | |
// <Type>RealmProxy objects are created by the Realm annotation processor. They are used to control | |
// access to the actual data instead of storing them in fields and it is therefore them we need to register a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Specific class for a RealmList<Bar> field | |
public class BarListParcelConverter extends RealmListParcelConverter<Bar> { | |
@Override | |
public void itemToParcel(Bar input, Parcel parcel) { | |
parcel.writeParcelable(Parcels.wrap(input), 0); | |
} | |
@Override | |
public Bar itemFromParcel(Parcel parcel) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a background thread | |
RealmThread t = new RealmThread(realmConfig, new RealmRunnable() { | |
@Override | |
public void run(Realm realm) { | |
do { | |
// Do some work once, and every time the Realm changes | |
} while (realm.waitForChange()) | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2016 Realm Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -w | |
# | |
# This script will analyze a Github repo and try to rank all open issues with regard to popularity. | |
# WARNING: This script will run quite a few HTTP requests against Github to do this analysis. At least 1 pr. issue. | |
# The current limit on Github is 5000 requests pr. hour: https://developer.github.com/v3/rate_limit/ | |
# | |
# Usage: ./ruby github-issue-rankings.rb <github_user/repo> <github_api_access_token> | |
# Example: ruby github_issue_rankings.rb realm/realm-java $GITHUB_ISSUE_RANKINGS_ACCESS_TOKEN | |
# | |
# The algorithm for ranking issues are the following: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Realm loadAssetFileOnMigration() { | |
// TODO Don't re-create this every time | |
RealmConfiguration config = new RealmConfiguration.Builder() | |
.schemaVersion(2) // Bumping the schema because new app | |
.build(); | |
Realm realm; | |
try { | |
realm = Realm.getInstance(config); |
OlderNewer