Skip to content

Instantly share code, notes, and snippets.

View katopz's full-sized avatar
🦀
Rust me if you can

Todsaporn Banjerdkit katopz

🦀
Rust me if you can
View GitHub Profile
/*
Gyroscope の ANE に付属の Gyroscope クラスをインポートして使用しています。
プロジェクトは FlashBuilder の ActionScript モバイルプロジェクトを
AIR for iOS(AIR 3.3)でビルドしました。
link
http://www.digifie.jp/blog/archives/998
http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/gyroscope.html
*/
@katopz
katopz / air-versionNumber.as
Created September 15, 2012 03:45
[AIR] Viewing versionNumber in the Application
//@see http://renaun.com/blog/2011/03/tips-for-ios-air-development/
import flash.desktop.NativeApplication;
// I put this in a try/catch so it does break SWF desktop testing with non-AIR testing
try
{
var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespaceDeclarations()[0];
versionNumber = descriptor.ns::versionNumber;
} catch(error:Error) { }
@katopz
katopz / gist:3852996
Created October 8, 2012 15:05
Drawing iOS UIViews to AS3 bitmapData via Adobe AIR native extensions
// note from http://tyleregeto.com/drawing-ios-uiviews-to-as3-bitmapdata-via-air
A major draw back to displaying native iOS UIView objects on top of your Adobe AIR applications is that they... well... are on top. Here is a quick code snippet for rendering native iOS view objects to ActionScript bitmapData objects via the recently released native extensions support. This allows you to add them to the display list (at the loss of all their native functionality). With native extensions we can update the bitmapData directly in memory which results in very fast updates. The possibilities are endless.
FREObject drawToBitmap(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
// grab the AS3 bitmapData object for writing to
FREBitmapData bmd;
@katopz
katopz / stage3d-kil-opcode
Created December 12, 2012 14:53
Stage3D kil opcode
refer to : http://www.kirupa.com/forum/showthread.php?374071-stage3d-AGAL-how-to-use-the-kil-opcode
AGAL:
[
"tex ft0, v0, fs0 <2d,clamp," + TextureSmoothing.NONE + ">", //store texture in ft0
"sub ft1.x ft0.a fc0.x", //store alpha - threshold (fc0.x) in temp ft.x
"kil ft1.x", //kill based on that
"mov oc, ft0" // move to output colour
]
@katopz
katopz / detect-mobile.js
Created January 10, 2013 15:37
how to determine user is use mobile device (btw no window mobile huh?)
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) )
{
// some code..
}
@katopz
katopz / build.xml
Created April 18, 2013 15:02
Stole this ant from @lidev ;) #ane #ant
<?xml version="1.0" encoding="UTF-8"?>
<project name="Adobe Native Extension Packager" default="all" basedir=".">
<property name="extensionName" value="UserPhotosExtension"/>
<property name="flexsdk" value="/Users/palebluedot/Documents/Libraries/Flex/flex-4.6.0.23201-air-3.6-asc2-preview5"/>
<target name="all" depends="clean,init,ios,compileswc,extractswf,copyfiles,package"/>
<target name="clean">
<delete dir="build"/>
@katopz
katopz / get-usb-id
Last active January 27, 2021 16:00
Will get all entries of all USB devices, the USB host controllers, the USB Root hubs , hubs and usb devices.
// refer to : http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/76315dfa-6764-4feb-a3e2-1f173fc5bdfd
// will get all entries of all USB devices, the USB host controllers, the USB Root hubs , hubs and usb devices.
// The results that are located at "USB\VID_xxx&PID_yyyy\zzzz"
// it may happen that you have more than one USB device with the same VID and PID on the system.
// Therfore you must also check for the serial# (the zzzz in the bold text). A USB device is only unique with VID+PID+seial#.
// with some decated fixed working via VS express 2012
// 2013/06/08
export XLIB="/Users/christo.smal/Library/Developer/Xcode/DerivedData/wherever-lib.a"
export CERT="/wherever/if/you/want/to/sign/ane.p12"
export FLEXLIBPATH="../Path/of/flex/library/project"
export XIBPATH="/Path/of/where/xib/files/are"
export SWCFNAME="FWAne.swc"
export ANEFNAME="FWAne.ane"
ls -la $XLIB
echo Copying files ...
@katopz
katopz / Program.cs
Created July 8, 2013 09:54
Open Internet Explorer -> hide menu bar, tool bar, status bar -> adjust width/height ->load local storage
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.ComponentModel;
namespace Foo
{
@katopz
katopz / Main
Created July 8, 2013 09:59
Use ShellExecute to launch the default Web browser modify from http://support.microsoft.com/kb/224816
// don't forget to link shell32.lib; via Linker -> Input
#include "stdafx.h"
#include <Windows.h>
#include <shellapi.h>
int _tmain(int argc, _TCHAR* argv[])
{
ShellExecute(NULL, TEXT("open"), TEXT("http://sleepydesign.com"), NULL, NULL, SW_SHOWNORMAL);
return 0;