Skip to content

Instantly share code, notes, and snippets.

View sdecima's full-sized avatar

Sebastián Décima sdecima

View GitHub Profile
@sdecima
sdecima / Android_enableManifestComponent.java
Created December 18, 2013 17:01
How to dynamically enable/disable an Android Component declared in the manifest.
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
public class Android_enableManifestComponent {
public static void enableManifestComponent(Context context, Class<?> component, boolean enable) {
ComponentName receiver = new ComponentName(context, component);
PackageManager pm = context.getPackageManager();
@sdecima
sdecima / Android_getNetworkInfo.java
Created December 18, 2013 17:46
How to get Network information on Android and detect if it's connected or not. Detect if Mobile or Wifi (or any other connection type) is currently connected.
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class Android_getNetworkInfo {
public static boolean isNetworkConnectedOrConnecting(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
@sdecima
sdecima / SingletonClass.java
Created May 13, 2014 03:03
Java (proper) Singleton Class
public class SingletonClass {
private SingletonClass() {
}
private static class SingletonClassHolder {
public static final SingletonClass INSTANCE = new SingletonClass();
}
public static SingletonClass getInstance() {

Keybase proof

I hereby claim:

  • I am sdecima on github.
  • I am sdecima (https://keybase.io/sdecima) on keybase.
  • I have a public key whose fingerprint is FD35 0CA3 462E 8615 28A9 173E DBA6 02F6 B5EC 181E

To claim this, I am signing this object:

@sdecima
sdecima / Trello_show_label_names_on_the_front_of_cards.user.js
Last active August 21, 2019 10:51 — forked from bmccormack/readme.md
Trello: show label names on the front of cards
// ==UserScript==
// @name Trello: show label names on the front of cards
// @namespace https://gist.github.com/sdecima/
// @version 0.2
// @description Show label names on the front of cards
// @author Sebastian Decima <sdecima@gmail.com>
// @match https://trello.com/*
// @include https://trello.com/*
// @grant none
// ==/UserScript==