View sayrandom.sh
#!/bin/bash | |
while true; do sleep 420; perl -e 'open IN, "</usr/share/dict/words";rand($.) < 1 && ($n=$_) while <IN>;print $n' | say; done |
View ListPageIndicator.java
import android.content.Context; | |
import android.support.v4.view.PagerAdapter; | |
import android.support.v4.view.ViewPager; | |
import android.support.v4.view.ViewPager.OnPageChangeListener; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.AdapterView; | |
import android.widget.AdapterView.OnItemClickListener; | |
import android.widget.ArrayAdapter; | |
import android.widget.ListView; |
View 51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev" #Acer | |
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev" #ASUS | |
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev" #Dell | |
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev" #Foxconn | |
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev" #Fujitsu | |
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev" #Fujitsu Toshiba | |
SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0666", GROUP="plugdev" #Garmin-Asus | |
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" #Google | |
SUBSYSTEM=="usb", ATTR{idVendor}=="201E", MODE="0666", GROUP="plugdev" #Haier | |
SUBSYSTEM=="usb", ATTR{idVendor}=="109b", MODE="0666", GROUP="plugdev" #Hisense |
View UndoBarController.java
/* | |
* Copyright 2012 Roman Nurik | |
* | |
* 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 |
View fullbattery
telnet localhost 5554 | |
power status discharging | |
power capacity 100 |
View AndroidManifest.xml
<receiver android:name=".SecretCodeReceiver"> | |
<intent-filter> | |
<action android:name="android.provider.Telephony.SECRET_CODE" /> | |
<data | |
android:scheme="android_secret_code" | |
android:host="1111" /> | |
</intent-filter> | |
</receiver> |
View AllEmailAdapter.java
private static final String EMAIL_REGEX = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; | |
private static final Pattern EMAIL_PATTERN = Pattern.compile(EMAIL_REGEX); | |
private ArrayAdapter<String> getEmailAddressAdapter(Context context) { | |
Account[] accounts = AccountManager.get(context).getAccounts(); | |
HashSet<String> emailSet = new HashSet<String>(); | |
for (int i = 0; i < accounts.length; i++) { | |
if (isEmailAddress(accounts[i].name)) { | |
emailSet.add(accounts[i].name); | |
} |
View EmailAdapter.java
private ArrayAdapter<String> getEmailAddressAdapter(Context context) { | |
Account[] accounts = AccountManager.get(context).getAccountsByType("com.google"); | |
String[] addresses = new String[accounts.length]; | |
for (int i = 0; i < accounts.length; i++) { | |
addresses[i] = accounts[i].name; | |
} | |
return new ArrayAdapter<String>(context, android.R.layout.simple_dropdown_item_1line, addresses); | |
} |
View gist:4224231
public class NotificationThumbnailHelper { | |
private float targetWidth; | |
private float targetHeight; | |
public NotificationThumbnailHelper(Context context) { | |
targetWidth = getTargetWidth(context); | |
targetHeight = getTargetHeight(context); | |
} |
View .bash_profile
# Git autocomplete script: | |
# curl https://github.com/git/git/raw/master/contrib/completion/git-completion.bash -OL | |
source /Users/jdamcd/git-completion.bash | |
alias checkout='git checkout' | |
alias clone='git clone' | |
alias la='ls -la' | |
alias gh='github' | |
alias code='cd /Users/jdamcd/Dropbox/Code' |