Skip to content

Instantly share code, notes, and snippets.

@tracend
tracend / swipe.as
Created April 2, 2011 12:01
AS3: Using the Swipe Gesture in Flash Using ActionScript 3.0 - Source: http://www.republicofcode.com/tutorials/flash/as3swipegesture/
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
square_mc.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe);
function onSwipe (e:TransformGestureEvent):void{
if (e.offsetX == 1) {
//User swiped towards right
square_mc.x += 100;
@jgranick
jgranick / gist:1763850
Created February 8, 2012 01:05
NMML File Specification
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- <meta />
Use meta nodes to set metadata for your application. The description is ignored
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets.
For compatibility with Android and webOS, the package name must include at least
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active October 25, 2025 05:37
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@jgranick
jgranick / README.md
Created August 8, 2012 22:44
How to setup Cordova support for NME

Install NME

First, go to http://www.haxenme.org/download and install NME.

Development Builds

Since Cordova support is a beta feature, we will continue to improve NME's support of Cordova over time. If you want, you can get the latest development build here:

@jgranick
jgranick / TilesheetExample.hx
Created October 2, 2012 21:46
How to use nme.display.Tilesheet (NME recipe)
import nme.display.Sprite;
import nme.display.Tilesheet;
import nme.geom.Rectangle;
import nme.Assets;
public class TilesheetExample extends Sprite {
public function new () {
@ruby0x1
ruby0x1 / TexturePackerJSON.hx
Created November 19, 2012 18:31
JSON TexturePacker importer for Haxenme haxelib SpriteSheet, with behavior and examples
package com.underscorediscovery;
import com.eclecticdesignstudio.spritesheet.data.SpriteSheetFrame;
import com.eclecticdesignstudio.spritesheet.SpriteSheet;
import com.eclecticdesignstudio.spritesheet.data.BehaviorData;
import hxjson2.JSON;
class TexturePackerJSON {
@agaricusb
agaricusb / gist:4575843
Created January 19, 2013 23:42
fernflower 0.8.6 cA NPE patch (fix for missing classes)
--- a/cA.java
+++ b/cA.java
@@ -234,7 +234,7 @@ public final class cA {
private aJ a(aK var1, cX var2, aG var3) {
aK var5 = (aK)aD.f().a().get(var3.g());
String var4 = cP.a(var3.k(), var3.h());
- if(var5.h.containsKey(var4) && (var4 = (String)var5.i.get(var4)) != null && var4.length() > 0) {
+ if(var5 != null && var5.h != null && var5.h.containsKey(var4) && (var4 = (String)var5.i.get(var4)) != null && var4.length() > 0) {
if(!a(var1, var5)) {
return null;
@AxGord
AxGord / Reference.hx
Last active December 19, 2015 01:09
Build simple help System for your apps.
package ;
import com.bit101.components.TextArea;
import com.bit101.components.List;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.filters.BlurFilter;
import flash.filters.GlowFilter;
import flash.geom.Rectangle;
import flash.net.URLLoader;
@Beeblerox
Beeblerox / dumpBits example
Created July 8, 2013 12:17
This is an example of how you can reduce memory usage for Tilesheet class in openfl with dumpBits() method. But you also listen for stage resize event and recreate tilesheet after context loss.
import flash.Lib;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import openfl.Assets;
import openfl.display.Tilesheet;
import flash.display.Graphics;
import flash.events.Event;
class Particle