Skip to content

Instantly share code, notes, and snippets.

@MagicMicky
MagicMicky / audio_detector.sh
Created Sep 23, 2015
Audio detection turn on hdmi
View audio_detector.sh
#!/bin/bash
SWITCH_ON_CMD="echo 'on 0' > /tmp/cec.fifo"
CHANGE_HDMI="echo 'as' > /tmp/cec.fifo"
if [ -e "/tmp/cec.fifo" ]; then
echo proceeding: file exists
else
echo You need to start the server.
exit
fi
@MagicMicky
MagicMicky / Adapters.java
Created Oct 12, 2014
An example showing the Adapter Design pattern, adapted to some account authentication
View Adapters.java
/*
* We want to auth our user on an application.
* We have two way to auth our user.
* We can either authenticate the user using his mail and password via Google, thanks to the Google SDK
* Or we can use the Facebook SDK to auth our user.
*/
public GoogleAuthenticator() {
public String authenticateViaGoogle(String mail, String password) {
//Android code
@MagicMicky
MagicMicky / BundleTestActivity.java
Last active Aug 29, 2015
A gist that allows to check whether or not objects given through a Bundle are of the same instance. Used for an example on http://magicmicky.github.io/android_development/loose_coupling_using_otto/
View BundleTestActivity.java
package com.magicmicky.loosecoopling;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@MagicMicky
MagicMicky / InflationPerformanceTestActivity.java
Last active Aug 29, 2015
Simple Android program to test performance gain when inflating temporary view programmatically or setting it to GONE and modify to VISIBLE when needed. Used for a blog article http://magicmicky.github.io/android_development/benchmark-using-traceview/
View InflationPerformanceTestActivity.java
package com.magicmicky.testperfviews;
import android.app.Activity;
import android.graphics.LinearGradient;
import android.os.Debug;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
You can’t perform that action at this time.