cd /path/to/repo-name
git checkout --orphan gh-pages
git rm -rf .
echo "My GitHub Page" > index.html
git add .
git commit -a -m "Add index.html"
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
/** | |
* @author marco | |
* Workaround to be able to scroll text inside a TextView without it required | |
* to be focused. For some strange reason there isn't an easy way to do this | |
* natively. | |
* | |
* Original code written by Evan Cummings: | |
* http://androidbears.stellarpc.net/?p=185 | |
*/ | |
public class ScrollingTextView extends TextView { |
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
import android.content.Context; | |
import android.util.Log; | |
import android.widget.Toast; | |
public class LogHelper { | |
private static final String LOG_TAG = MyConstants.APP_NAME; | |
public static void log(String message) { | |
Log.d(LOG_TAG, message); | |
} |
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
private boolean checkForPower() { | |
// It is very easy to subscribe to changes to the battery state, but you can get the current | |
// state by simply passing null in as your receiver. Nifty, isn't that? | |
IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); | |
Intent batteryStatus = this.registerReceiver(null, filter); | |
// There are currently three ways a device can be plugged in. We should check them all. | |
int chargePlug = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); | |
boolean usbCharge = (chargePlug == BatteryManager.BATTERY_PLUGGED_USB); |
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
def versionMajor = 3 | |
def versionMinor = 0 | |
def versionPatch = 0 | |
def versionBuild = 0 // bump for dogfood builds, public betas, etc. | |
android { | |
defaultConfig { | |
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild | |
versionName "${versionMajor}.${versionMinor}.${versionPatch}" | |
} |
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
def publish = project.tasks.create("copyReleaseApkToCustomDir") | |
publish.description "Copies release apk to custom directory" | |
android.applicationVariants.all { variant -> | |
if (variant.buildType.name.equals("release")) { | |
variant.outputs.each { output -> | |
if ( output.outputFile != null && output.outputFile.name.endsWith('.apk')) { | |
def task = project.tasks.create("copyAndRename${variant.name}Apk", Copy) | |
def outputFile = output.outputFile | |
println "Creating " + rootProject.name + "-${versionName}.apk" + " from " + project.name + "-${variant.name}.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
defaultConfig { | |
versionCode buildVersionCode() | |
versionName version | |
} |
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
apply from: "../artifacts.gradle" |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
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
// |
OlderNewer