Skip to content

Instantly share code, notes, and snippets.

View creativedrewy's full-sized avatar

Andrew Watson creativedrewy

View GitHub Profile
@creativedrewy
creativedrewy / gist:3411593
Created August 21, 2012 04:35
Android List of Installed Apps
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lView = (ListView) findViewById(R.id.list1);
PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
@creativedrewy
creativedrewy / flashpolicy.xml
Created October 13, 2012 01:56 — forked from mattcg/flashpolicy.xml
A simple Flash socket policy server for NodeJS.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for xmlsocket://socks.example.com -->
<cross-domain-policy>
<!-- This is a master socket policy file -->
<!-- No other socket policies on the host will be permitted -->
<site-control permitted-cross-domain-policies="master-only"/>
@creativedrewy
creativedrewy / as3 embed sample.as3
Created November 7, 2012 03:20
Cannot embed sym-linked files in AS3 on Windows
[Embed(source="assets/socketMessages.json", mimeType="application/octet-stream")]
public var SocketMessages:Class;
@creativedrewy
creativedrewy / LinkedAssetLibraryBase.as
Created November 8, 2012 02:12
Use AS3 describeType() to dynamically list out strongly-typed referenced assets in a class
package com.creativedrewy.app.model.assetlibrary
{
import flash.display.Sprite;
import flash.utils.describeType;
import flash.utils.getDefinitionByName;
/**
* Base class for asset libraries that index their clips based on the "asset helper"
* model, where assets are ref'd only by class name
*/
@creativedrewy
creativedrewy / SampleManifestAdditions.xml
Last active December 11, 2015 04:08
An example of how to setup an Adobe AIR for Android application xml file to enable incoming NFC data.
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<!-- I left out the "default" AIR manifest additions that are there by default. You should keep those. -->
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
<application android:enabled="true">
<activity android:excludeFromRecents="false">
@creativedrewy
creativedrewy / NFCDataHandling.as
Last active December 11, 2015 04:08
Sample Adobe AIR Android application class that handles incoming NFC intent data.
package
{
import flash.desktop.NativeApplication;
import flash.events.InvokeEvent;
public class NFCDataHandling extends Sprite
{
/**
* Constructor
*/
@creativedrewy
creativedrewy / one_arg_cs_func_wrong_way.coffee
Last active December 14, 2015 17:29
Using the "do" keyword in coffeescript
#Calling a function with arguments:
returnData = processData "First Argument", 3, "third"
#Pretend the same function had no arguments, call like this? No, wrong:
returnData = processData
@creativedrewy
creativedrewy / one_arg_cs_func_right_way.coffee
Created March 9, 2013 03:09
Using the "do" keyword in coffeescript
#The right way to call the no-argument function:
returnData = do processData
@creativedrewy
creativedrewy / immediate_call_inline_function.coffee
Created March 9, 2013 03:29
Using the "do" keyword in coffeescript
switch message
when "hi" then returnData = "bye"
when "goodbye" then do ->
part1 = "This is just "
part2 = "a sample of how to do this"
returnData = part1 + part2
@creativedrewy
creativedrewy / Language Logos
Last active August 29, 2015 14:10
Programming Language Logos
Programming Language/Frameworks URLs:
http://commons.wikimedia.org/wiki/File:Java_logo_and_wordmark.svg
http://commons.wikimedia.org/wiki/File:Ruby_on_Rails_logo.svg
http://commons.wikimedia.org/wiki/File:PHP-logo.svg
http://commons.wikimedia.org/wiki/File:HTML5_logo_and_wordmark.svg
http://commons.wikimedia.org/wiki/File:Python-logo-notext.svg
http://commons.wikimedia.org/wiki/File:Android_logo_2.svg
http://commons.wikimedia.org/wiki/File:Apple_iOS_new.svg