Skip to content

Instantly share code, notes, and snippets.

View thanksmister's full-sized avatar

Mister thanksmister

View GitHub Profile
@thanksmister
thanksmister / IconButton.as
Created April 28, 2011 18:03
This example sets an Icon with two states on a Spark Button using a Spark Skin.
/**
To using in a Flash Builder project:
<controls:IconButton icon="@Embed('assets/images/icon.png')" iconOver="@Embed('assets/images/icon_over.png')" label="Label Button" skinClass="com.thanksmister.components.skins.IconButtonSkin"/>
*/
package com.thanksmister.components.controls
{
import spark.components.Button;
import spark.primitives.BitmapImage;
@thanksmister
thanksmister / list.xml
Created May 28, 2011 21:55
Remove the blur and shadow effect on an Android ListView componet.
<?xml version="1.0" encoding="utf-8"?>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:cacheColorHint="#00000000"
android:fadingEdge="none"/>
@thanksmister
thanksmister / gist:1187691
Created September 2, 2011 00:48
Scale BitmapData Method
protected static function scaleImage(bitmapData:BitmapData, width:Number, height:Number):BitmapData
{
// Calculate the scaled size.
var scale:Number;
var scaledWidth:Number;
var scaledHeight:Number;
scale = Math.min(width/(bitmapData.width as Number), height/(bitmapData.height as Number))
scaledHeight = bitmapData.height * scale;
@thanksmister
thanksmister / Main.mxml
Created November 25, 2011 22:05
Flex component to display modal popup windows that self-close on delay using the SkinnablePopUpContainer.
<?xml version="1.0" encoding="utf-8"?>
<!--
Michael Ritchie
mister@thanksmister.com
Copyright 2011 ThanksMister LLC
-->
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
@thanksmister
thanksmister / ImageButtonSkin.mxml
Created December 10, 2011 17:44
Flex Spark Image component with skin to make rounded corners and border.
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
alpha.disabled="0.5" >
<fx:Metadata>[HostComponent("spark.components.Image")]</fx:Metadata>
<fx:Script>
<![CDATA[
@thanksmister
thanksmister / ImageButton.as
Created December 11, 2011 22:09
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, @pixels4nickles
* @version Dec 9, 2011
* */
package
{
import flash.events.Event;
import mx.events.FlexEvent;
@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;
@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 / 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 / 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_