Skip to content

Instantly share code, notes, and snippets.

View JaisonBrooks's full-sized avatar

Jaison Brooks JaisonBrooks

  • Enphase Energy
  • Boise, ID
View GitHub Profile
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
@JaisonBrooks
JaisonBrooks / 0_reuse_code.js
Created July 1, 2014 15:32
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/usr/bin/python
import sys
import argparse
import os
import re
'''
A simple script to create lower-resolution Android drawables from higher-resolution ones.
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
@JaisonBrooks
JaisonBrooks / bash-progress
Created August 4, 2014 15:54
Bash-Progress Bar
echo -ne '##### (33%)\r'
sleep 1
echo -ne '############# (66%)\r'
sleep 1
echo -ne '####################### (100%)\r'
echo -ne '\n'
@JaisonBrooks
JaisonBrooks / data-transfer-bash-shell
Created August 4, 2014 16:00
Transfer Files between computers - Bash
# on computer A, with IP address 192.168.1.100
$ tar -cf - /path/to/dir | pv | nc -l -p 6666 -q 5
# on computer B
$ nc 192.168.1.100 6666 | pv | tar -xf -
@JaisonBrooks
JaisonBrooks / listview_padding_fix
Created August 6, 2014 17:37
ListView - Padding Fix
<ListView
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="@android:color/transparent"
android:dividerHeight="10.0sp"
android:padding="16dip"
android:clipToPadding="false"/>
// The Magic is this | android:clipToPadding="false"
@JaisonBrooks
JaisonBrooks / new_post_googleplus.java
Last active August 29, 2015 14:05
Text to new Google + post
Intent shareIntent = ShareCompat.IntentBuilder.from(ShareActivity.this)
.setText("This site has lots of great information about Android! http://www.android.com")
.setType("text/plain")
.getIntent()
.setPackage("com.google.android.apps.plus");
startActivity(shareIntent);
/**
* A collection of authentication and account connection utilities. With strong inspiration from the Google IO session
* app.
* @author Dandré Allison
*/
public class AccountUtils {
/**
* Interface for interacting with the result of {@link AccountUtils#getUserProfile}.
*/
package com.nhaarman.test;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RadialGradient;