Skip to content

Instantly share code, notes, and snippets.

View peterblazejewicz's full-sized avatar
:octocat:
@code #remote #ssh #raspberrypi

Piotr Błażejewicz (Peter Blazejewicz) peterblazejewicz

:octocat:
@code #remote #ssh #raspberrypi
View GitHub Profile
@peterblazejewicz
peterblazejewicz / gist:995257
Created May 27, 2011 13:34
hide scrollbars in browser via javascript
javascript:document.body.style.overflow = 'hidden'
javascript:document.body.style.overflowX = 'hidden'
@peterblazejewicz
peterblazejewicz / gist:998586
Created May 30, 2011 08:00
save xml with flash.net.FileReference
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="320" height="480"
applicationComplete="mdm.Application.init(this);"
creationComplete="Controller.instance.model.existingDataObj.existingDataXML = xml;">
<fx:Declarations>
<fx:XML format="e4x" id="xml" xmlns="">
@peterblazejewicz
peterblazejewicz / gist:1006205
Created June 3, 2011 11:15
prevent CMD+Q default action
import mdm.Application;
import mx.controls.Alert;
import mx.events.CloseEvent;
//
// when application starts
// enable exit handler
// and route exit event to custom handler
// to get user action
//
@peterblazejewicz
peterblazejewicz / gist:1007998
Created June 4, 2011 15:45
enumerate windowed applications and convert results to custom VO for better handling
package
{
import mdm.System;
import spark.components.Application;
public class MyApplication extends Application
{
[Bindable]
public var txt:String = "";
@peterblazejewicz
peterblazejewicz / gist:1014181
Created June 8, 2011 10:36
background downloading using {mdm} script and showing loaded image (local) into spark component
package
{
import mdm.HTTP;
import mx.controls.ProgressBar;
import spark.components.Application;
import spark.components.Image;
public class MyApplication extends Application
@peterblazejewicz
peterblazejewicz / gist:1018522
Created June 10, 2011 09:08
load local web page and local video into application using "file://" protocol converted paths
package
{
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import mdm.Application;
import mdm.Browser;
import spark.components.Application;
@peterblazejewicz
peterblazejewicz / gist:1106408
Created July 26, 2011 09:55
quit application feature script
public function exitButtonClickHandler(event:MouseEvent):void
{
// do runtime check for presence of "filename"
if(mdm.Application && mdm.Application.filename.length)
{
mdm.Application.exit();
} else
{
flash.system.fscommand("quit");
};
@peterblazejewicz
peterblazejewicz / gist:1108962
Created July 27, 2011 08:58
pathForFlash helper - converts to FILE protocol and full path URI
function pathForFlash(path:String):String
{
// in ZINC runtime convert paths to URI FIle protocol
// for content loading via Flash native features
if(mdm.Application && mdm.Application.filename.length)
{
return "file://"+mdm.Application.path.split("\\").join("/")+path;
};
return path;
}
// machine host name required for uri
var host:String = mdm.System.Registry.loadString(3,
"SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName",
"ComputerName");
// share name
var share:String = "myfolder";
// folder absolute path converted to URI path (strip volume root)
var folderPath:String = mdm.Application.path.substr(3);
// construct full path
var uriPath:String = "\\\\"+host+"\\"+share+"\\"+folderPath;
@peterblazejewicz
peterblazejewicz / gist:1175967
Created August 27, 2011 22:49
Launch Adobe Air application from Cocoa application and pass arguments
NSString *appPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"TourDeFlex.app"];
if(!appPath) return;
NSURL *url = [NSURL URLWithString:appPath];
NSArray *args = [NSArray arrayWithObjects:@"-show", @"exampleName", nil];
NSDictionary *options = [NSDictionary dictionaryWithObject:args
forKey:NSWorkspaceLaunchConfigurationArguments];
NSError *launchError = nil;
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:url
options:NSWorkspaceLaunchDefault
configuration:options