Skip to content

Instantly share code, notes, and snippets.

configurations {
apt
}
dependencies {
compile 'com.squareup.dagger:dagger:1.1.0'
apt 'com.squareup.dagger:dagger-compiler:1.1.0'
}
android.applicationVariants.all { variant ->
@creativepsyco
creativepsyco / setup.sh
Created March 11, 2014 16:49
setup bundle
mkdir mozilla
hg init mozilla
cd mozilla
wget http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/mozilla-central.hg
hg unbundle mozilla-central.hg
@creativepsyco
creativepsyco / gist:9322214
Last active August 29, 2015 13:56
Host Python Server in Current Directory.
#Python 2
python -m SimpleHTTPServer 8080
#Python 3
python3 -m http.server 8113
@creativepsyco
creativepsyco / install.sh
Last active August 29, 2015 13:56
Installation file for transifex
sudo apt-get install python python-setuptools python-imaging python-dev gettext intltool python-django python-pip git unzip zip
easy_install -U setuptools
easy_install http://trac.transifex.org/files/deps/contact_form-0.3.tar.gz
easy_install http://trac.transifex.org/files/deps/userprofile-0.7-r422-correct-validation.tar.gz
pip install celery chardet "Django==1.3.1" "django-addons>=0.6.6" "django-ajax-selects==1.1.4" "django-authority" "django-celery" django-kombu django-picklefield "django-piston==0.2.2" "django-social-auth" "django-sorting>=0.1" "django-tagging-autocomplete==0.3.1" "django-threadedcomments>=0.9" "django-userena" "hiredis>=0.1.0" httplib2 markdown "PIL>=1.1.7" "polib==0.6.3" pygooglechart pysolr "redis>=2.4.10" requests "South==0.7.3" "BeautifulSoup==3.2.0" "django-staticfiles==1.2.1" python-magic
pip install 'https://pypi.python.org/packages/source/d/django-filter/django-filter-0.5.1.tar.gz#md5=f28c24251ba108940ddc5b77a4ed829d'
@creativepsyco
creativepsyco / HackFB.diff
Last active July 26, 2017 02:40
Facebook Android SDK 3.6.0 OAuth using embedded Web View
diff --git i/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java w/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java
index 70ac868..c2c9af0 100644
--- i/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java
+++ w/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java
@@ -17,6 +17,7 @@
package com.facebook.widget;
import android.annotation.SuppressLint;
+import android.app.AlertDialog;
import android.app.Dialog;
--- i/wire-compiler/src/main/java/com/squareup/wire/MessageWriter.java
+++ w/wire-compiler/src/main/java/com/squareup/wire/MessageWriter.java
@@ -94,10 +94,20 @@ public class MessageWriter {
} else if (type instanceof EnumType) {
EnumType enumType = (EnumType) type;
writer.beginType(enumType.getName(), "enum", EnumSet.of(PUBLIC));
+ int index = 0;
for (EnumType.Value value : enumType.getValues()) {
MessageWriter.emitDocumentation(writer, value.getDocumentation());
writer.emitAnnotation(ProtoEnum.class, value.getTag());
@creativepsyco
creativepsyco / crash_dump
Created November 14, 2013 01:52
Saavn Crash Dump
11-14 09:47:07.004 13580-15702/? I/DATA﹕ DATA:Response from server for call to: http://www.saavn.com __call=app.getLaunchData::::{"notification_duration":10000,"connection_timeout":60000,"socket_timeout":60000,"app_version":13,"ads":{"carrier":"null"},"supported_languages":["hindi","tamil","telugu","punjabi","marathi","gujarati","bengali","kannada","bhojpuri","malayalam"],"radio_supported_languages":["hindi"],"ad_config":{"networks":["dfp","inmobi","admob"],"spotlight_config":{"spotlight_image_width":"320","spotlight_image_height":"86","spotlight_image_expiry":"0","spotlight_view_image_width":"320","spotlight_view_image_height":"86","spotlight_view_image_expiry":"0","spotlight_image":"http:\/\/s.saavncdn.com\/apps\/spotlight\/img\/SDPT-1-201311081253.jpg","spotlight_view_image":"http:\/\/s.saavncdn.com\/apps\/spotlight\/img\/SDPT-2-201311081253.jpg","spotlight_movie_acronym":"SDPT","spotlight_action":"PLAYLIST_SHOW","spotlight_content":"4711157","spotlight_content_name":"DJ Suketu Presents TGIF","spotlight
@creativepsyco
creativepsyco / HideKeyboardFromView.java
Last active December 26, 2015 23:19
Hide the keyboard from view
// Very useful to capture the focus if there is a need to
// Currently this hides the keyboard from the view
// If the underlying view is not an EditText
// For this to work all the parent layouts
// must declare themselves as focusableinTouchMode
// Focusable and clickable
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
View v = getActivity().getCurrentFocus();
boolean ret = super.dispatchTouchEvent(ev);
@creativepsyco
creativepsyco / .zpreztorc
Created October 22, 2013 17:05
ZSH Configuration (Zpreztorc)
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
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)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')