Skip to content

Instantly share code, notes, and snippets.

@mburumaxwell
mburumaxwell / ActionBarActivityDelegateCompat.java
Created January 4, 2014 11:18
Implementing PreferenceActivity using ActionBarCompat. Add all these files to your project in a package name: android.support.v7.app In your PreferenceActivity extend ActionBarPreferenceActivity If you haven't started using ActionBarCompat and need to implement a PreferenceActivity, I advice you use ActionBarSherlock
package android.support.v7.app;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
@cyrilmottier
cyrilmottier / AndroidManifest.xml
Last active January 30, 2023 00:04
Android example of how to add a custom logo to the ActionBar and ensure the best possible matching starting Window.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.anapp">
<!-- ... -->
<application
android:icon="@drawable/ic_launcher"
android:label="@string/config_app_name"
android:theme="@style/Theme.AnApp" >
@tshrkmd
tshrkmd / styles_noactionbar.xml
Last active November 3, 2022 09:58
Theme.AppCompat.Light.NoActionBar
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item> <!-- For 2.x version -->
</style>
</resources>
@toolmantim
toolmantim / 1 Readme.md
Created July 26, 2012 19:39
Minification with newlines using the Rails 3 asset pipeline

Retaining line numbers with the Rails asset pipeline

By default the Rails 3 asset pipeline uses the Uglifier gem to optimize and minify your Javascript. One of its many optimisations is to remove all whitespace, turning your Javascript into one very long line of code.

Whist removing all the newlines helps to reduce the file size, it has the disadvantage of making your Javascript harder to debug. If you've tried to track down Javascript errors in minified Javascript files you'll know the lack of whitespace does make life harder.

Luckily there is a simple solution: to configure Uglifier to add newlines back into the code after it performs its optimisations. And if you're serving your files correctly gzip'd, the newlines add only a small increase to the final file size.

You can configure Uglifier to add the newlines by setting the following in your Rails 3 config/production.rb file:

@romannurik
romannurik / SwipeDismissListViewTouchListener.java
Last active May 1, 2021 10:16
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
Moved to
https://github.com/romannurik/android-swipetodismiss
@evanbeard
evanbeard / registrations_controller.rb
Created May 11, 2012 19:53 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else