Skip to content

Instantly share code, notes, and snippets.

View thanksmister's full-sized avatar

Mister thanksmister

View GitHub Profile
@thanksmister
thanksmister / EllipsisTextView.java
Created October 16, 2012 23:10
Adds listener to Android TextView when text has ellipsis.
/**
* Author: Michael Ritchie, ThanksMister LLC
* Date: 10/16/12
* Web: thanksmister.com
*
* Extension of <code>TextView</code> that adds listener for ellipses changes. This can be used to determine
* if a TextView has an ellipses or not.
*
* Derived from discussion on StackOverflow:
*
@thanksmister
thanksmister / MQTTSpeak.py
Last active August 21, 2022 21:11
Raspberry Pi, eSpeak, and MQTT
# Setup Raspberry Pi with WiFi
# Install Paho and eSpeak libraries for Raspberry Pi
# Run using "python3 MQTTSpeak.py"
# Import MQTT client.
import os
import time
import paho.mqtt.client as paho
# MQTT credentials
@thanksmister
thanksmister / AndroidScroll.as
Created October 18, 2010 17:47
The is an AS3 list that works for both Android and iOS devices. It responds to touch scrolling and touch selection of individual list items. You can use this within Flex Builder or CS5 Flash Professional Android/iPhone project.
/**
* @author Michael Ritchie
* @blog http://www.thanksmister.com
* @twitter Thanksmister
* Copyright (c) 2010
*
* This is a AS3 application to test the TouchList component.
* */
package
{
@thanksmister
thanksmister / DataService.java
Last active February 11, 2020 09:23
RxJava Polling Example
// data sevice class calling API and returning list of exchanges
public class DataService
{
private PublishSubject<List<Exchange>> exchangesRequest;
public DataService()
{}
// Get exchanges without any polling which returns results to subscription on time
public Subscription getExchanges(final Observer<List<Exchange>> observer)
@thanksmister
thanksmister / IconButtonBarButton.as
Created April 28, 2011 19:33
Example of Spark ButtonBar Skin with different icons states using custom ButtonBarButton Spark Skin.
package com.thanksmister.components.controls
{
import spark.components.ButtonBarButton;
import spark.primitives.BitmapImage;
public class IconButtonBarButton extends ButtonBarButton
{
[SkinPart(required = "false")]
public var iconElement:BitmapImage;
@thanksmister
thanksmister / groups.yaml
Created October 15, 2018 22:50
Home Assistant Groups Yaml Exanple
default_view:
name: Home
view: yes
entities:
- group.heater_system
- group.alarm_system
- group.lights
- group.outside_cameras
- group.air_controls
@thanksmister
thanksmister / mosquitto.conf
Last active October 8, 2018 18:20
Snips Raspberry Pi Setup to talk with HA using intents (not as satellite).
# /etc/mosquitto/conf.d/mosquitto.conf
# Bridge to HA
connection snips-ha
# bridge_cafile /etc/mosquitto/
bridge_insecure true
address 192.168.86.228:1883
cleansession false
clientid snips
start_type automatic
#username _your user_
@thanksmister
thanksmister / TimeZoneUtil.as
Created October 6, 2011 22:19
Utility class for determining local machine timezone in Flex, AIR, and AS3.
package
{
public class TimeZoneUtil
{
import com.adobe.utils.DateUtil;
/**
* List of timezone abbreviations and matching GMT times.
* Modified form original code at:
* http://blog.flexexamples.com/2009/07/27/parsing-dates-with-timezones-in-flex/
@thanksmister
thanksmister / MaskedImage.as
Created September 11, 2012 19:28
Flex Spark Image Control with Skin to mask image with custom image mask file.
/**
* @authors Michael Ritchie
* @twitter @thanksmister
* @version Sept 11, 2012
*
* Use:
* <controls:MaskedImage source="assets/imageToMask.png" height="200" width="200" maskImage="assets/mask.png"/>
* The mask image can be any shaped, just make it in Photoshop, but should be smaller than the image you wish to mask.
* Try just making a black mask shape and saving it out as .png file with alpha.
* */
@thanksmister
thanksmister / ImageButton.as
Created January 17, 2012 18:29 — forked from pixels4nickels/ImageButton.as
Flex Spark Image Button component with rounded corners. Wraps the Image control and takes same source for image. .
/**
* @authors Michael Ritchie, Ken Rogers
* @twitter @thanksmister, @pixels4nickels
* @version Dec 9, 2011
* */
package
{
import flash.events.Event;
import mx.events.FlexEvent;