Skip to content

Instantly share code, notes, and snippets.

View frontrangerider2004's full-sized avatar

FrontRangeRider frontrangerider2004

  • Colorado
  • 04:15 (UTC -06:00)
View GitHub Profile
@frontrangerider2004
frontrangerider2004 / chart-bar.html
Created December 3, 2015 23:50
chart-bar suggested fix for not rendering
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="chart-js-import.html">
<link rel="import" href="dataset-properties-behavior.html">
<link rel="import" href="context-behavior.html">
<link rel="import" href="resize-behavior.html">
<link rel="import" href="chart-styles.html">
<dom-module id="chart-bar">
<template>
@frontrangerider2004
frontrangerider2004 / Project Structure
Last active December 4, 2015 14:55
Bare-bones example of using <chart-bar> in a custom wrapper that holds data.
.
├── app
│   ├── my-chart.html
│   └── polymer-app.html
|
└── FrontEnd
└── bower_components
├── chart-elements
├── Chart.js
├── polymer
import android.util.Log;
/**
* Android Logger Util:
* Handles making nice pretty debug statements.
*/
public class Logger {
private final String TAG;
private final Boolean DEBUG = true; //TODO get this from BuildConfig
private final Boolean WARN = true; //TODO get this from BuildConfig
package com.frontrangrider;
import android.util.SparseArray;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
public enum KeyValueEnum {
FIRST(1, "FIRST"),
@frontrangerider2004
frontrangerider2004 / IntentServiceStatusReceiver.java
Last active June 13, 2016 19:33
Shows a robust way to get work off the UI thread in Android. Runs a Linux cmd in another thread.
package com.frontrangerider.SubProcess;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import com.frontrangerider.intents.MyIntentActions;
import com.frontrangerider.intents.MyIntentExtras;
import com.frontrangerider.util.Logger;
#!/bin/bash
####################################################################
# Bash Script Template
# Extend this template to produce a custom bash script that can
# only be run as root, makes temp dirs, and handles ungraceful
# exits by using trap. The script also demonstrates how to accept
# command line arguments.
# NOTE: The run-as-root requirement can easily be removed.
####################################################################
###############################################################################
# generateOutputFilename
#
# Get a unique timestamped filename with the date, git hash, and branch to
# patch. The stanza is <userPrefix>-date-hash-for-<branch>.patch
#
# NOTE: Date formate is ddmmyy_hhmmss in 24hr format
# NOTE: Git hash is the last 7 chars
###############################################################################
function generateOutputFilename {
SCRIPT_NAME="$(basename -- "$0")"
ABS_SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
####################################################################
# setAbsolutePathofDirectory
#
# PARAMS: directory, String
# cd's into the directory and prints the dir name, then cd's back.
####################################################################
function setAbsolutePathofDirectory {
@frontrangerider2004
frontrangerider2004 / MyDatabaseService.java
Created July 31, 2016 19:45
Threaded and Queued Heavy R/W For Android Databases
/**
Android service skeleton that performs intensive off main thread database operations.
This example uses a HandlerThread which will queue up requests rather than parallelize
them, which is good for database operations.
*/
public class MyDatabaseService extends Service {
private HandlerThread databaseThread;
private Handler databaseHandler;
private MyDatabaseHelper dbHelper;
@frontrangerider2004
frontrangerider2004 / while-read-loops-and-find.bash
Last active September 7, 2016 15:16
Shows how to use while read loops and the find command to properly loop over the output of a find command.
#!/bin/bash
#######################################################################
# Examples of using the find commands
#######################################################################
# This is an unsafe and bad way to loop over output of find commands
# One should use the while read loop to avoid potential errors with the output
# of the find command. See below:
for file in $(find . -maxdepth 1 -type d -path Projects -prune -o -print);
do