Skip to content

Instantly share code, notes, and snippets.

@nighthawk24
nighthawk24 / Android App UI Requirements
Last active December 19, 2015 06:19
A collection of UI specifications/requirements for Android Apps
Icons:
Refer http://developer.android.com/design/style/iconography.html
App Launcher Icon:
Sizes – 48x48dp (Full Asset), 512x512dp
Extended:
drawable-ldpi (120 dpi, Low density screen) - 36px x 36px
drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px
drawable-hdpi (240 dpi, High density screen) - 72px x 72px
drawable-xhdpi (320 dpi, Extra-high density screen) - 96px x 96px
@nighthawk24
nighthawk24 / GCM Performance Factors
Last active December 19, 2015 07:59
A brief list of factors affecting GCM performance
GCM/Internet Network:
Device on a network where GCM ports are blocked. COMMON IN ENTERPRISE ENVIRONMENT. CAN REQUEST TO OPEN PORTS, SAME GOES FOR APPLE PUSH.
Heavy GCM Service Traffic. RARE.
Delays in receiving notification on certain devices. RARE-COMMON. Instant-2mins-5mins depending on the Manufacturer Setting.
On the Device Side:
Wi-Fi Sleep and Performance Setting. COMMON.
Poor Data Network Connection (Wi-Fi/Cell-Data). VERY COMMON.
Device Sleep Setting. COMMON.
Background Data Restriction for app. RARE.
@nighthawk24
nighthawk24 / FirefoxOS App Development
Created August 26, 2013 20:19
Links to get started with FirefoxOS Development
App Manifest: https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest
Mozilla: https://hacks.mozilla.org/2013/07/getting-started-with-apps-firefox-os-for-developers-the-platform-html5-deserves/
Marketplace: https://marketplace.firefox.com/
Submitting an app to Firefox Marketplace: https://developer.mozilla.org/en-US/docs/Web/Apps/Publishing/Submitting_an_app?redirectlocale=en-US&redirectslug=Apps%2FPublishing%2FSubmitting_an_app
Partner with Firefox OS: https://www.mozilla.org/en-US/firefox/partners/#
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
#!/usr/bin/env ruby
# Please read http://otobrglez.opalab.com for more information about this code.
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
public static boolean setProxy(WebView webview, String host, int port, String applicationClassName="android.app.Application") {
// 3.2 (HC) or lower
if (Build.VERSION.SDK_INT <= 13) {
return setProxyUpToHC(webview, host, port);
}
// ICS: 4.0
else if (Build.VERSION.SDK_INT <= 15) {
return setProxyICS(webview, host, port);
}
// 4.1-4.3 (JB)
@nighthawk24
nighthawk24 / android-networkinfo
Last active August 29, 2015 13:58
Android network related methods
public String getLocalIpAddressInfo() {
WifiManager wifii= (WifiManager) getSystemService(getApplicationContext().WIFI_SERVICE);
DhcpInfo d=wifii.getDhcpInfo();
String s_dns1="DNS 1: " + Formatter.formatIpAddress(Integer.valueOf(d.dns1));
String s_dns2="DNS 2: "+ Formatter.formatIpAddress(Integer.valueOf(d.dns2));
String s_gateway="Default Gateway: " + Formatter.formatIpAddress(Integer.valueOf(d.gateway));
String s_ipAddress="IP Address: "+ Formatter.formatIpAddress(Integer.valueOf(d.ipAddress));
String s_leaseDuration="Lease Time: "+ Integer.valueOf(d.leaseDuration);
String s_netmask="Subnet Mask: "+ Formatter.formatIpAddress(Integer.valueOf(d.netmask));
@nighthawk24
nighthawk24 / android-AsyncTask-DownloadFile
Created April 7, 2014 20:15
DownloadFile using AsyncTask
new DownloadFile().execute("");
private class DownloadFile extends AsyncTask<String, Void, String> {
protected String doInBackground(String... params) {
InputStream input = null;
OutputStream output = null;
HttpURLConnection connection = null;
try {
@nighthawk24
nighthawk24 / gitignore-android-iOS
Created April 18, 2014 17:59
.gitignore for Android and iOS development
.DS_Store
#Android
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
Need jq (https://stedolan.github.io/jq/)
curl https://api.github.com/users/<user>/starred |
jq -r '.[].html_url' |
while read rp
do
git clone $rp
done
If you dont want to use jq you can replace with this ugly awk line