Skip to content

Instantly share code, notes, and snippets.

View matt-curtis's full-sized avatar

Matt Curtis matt-curtis

View GitHub Profile
@matt-curtis
matt-curtis / Fireworks CSXS Notes.md
Last active August 29, 2015 14:12
Fireworks CSXS Notes

Building CSXS extensions for Fireworks with Adobe Flash Builder 4.x

1.) Fireworks does not have it's own CSWSBlaBlaLib to encapsulate DOM manipulation from AS3. You can only use this to execute JS functions (defined in your CSXS manifest.xml)

CSInterface.instance.evalScript("jsFunctionName", ..params);

This method is even more fun than the MMExecute method you'd be using if you were writing a normal panel, becuase all return objects have to be an XML string. I'm not kidding you. XML. You know, the markup format that is most well known for its use in RSS feeds.

@matt-curtis
matt-curtis / Complete Fireworks Event List.md
Created January 5, 2015 14:50
Complete Fireworks Event List (as of CS6)

Events not mentioned in the official documentation have an asterick beside them.

IsFwCallbackInstalled*
onFwEnterSymbolEdit*
onFwStopMovie
onFwStartMovie
onFwWidgetLibraryChange*
onFwWindowFocusChange*
onFwSystemColorChanged*

onFwDocumentSave

@matt-curtis
matt-curtis / gist:d9b46b59834dc781cd6e
Last active August 29, 2015 14:15
Fireworks Errata, Part 2

Weird $ Variable. On further inspection seems to be a light implemtation of a variable from ExtendScript?? http://jongware.mit.edu/idcs6js/pc_%24.html

$.evalFile(filename:String, timeout:int) // not sure if fw cares about timeout
$.getenv(str:String) // gets enviroment variables...interesting

Fireworks Document

dom.saveAllAsync()
dom.saveDocumentAsync()
dom.saveDocumentAsAsync(doc, saveAsCmd:Boolean)
@matt-curtis
matt-curtis / MCTextFormatConverter.h
Created March 14, 2015 16:22
HTML to Attributed String & Attributed String to HTML
#import <Foundation/Foundation.h>
@interface MCTextFormatConverter : NSObject
+ (NSString*) convertTextInResponderToHTML:(UIView<UITextInput>*)view convertSelectionOnly:(BOOL)convertSelectionOnly;
+ (NSAttributedString*) htmlToAttributedString:(NSString*)html;
@end
@matt-curtis
matt-curtis / G510 Yosemite Notes.md
Last active November 23, 2016 23:30
Lenovo G510 - OS X Yosemite Install Notes
@matt-curtis
matt-curtis / NSFetchedResultsController+UICollectionView.m
Last active August 29, 2015 14:24
NSFetchedResultsController & UICollectionView using blocks (Moved Items & Deleted/Inserted Sections Fix)
@interface YourNSFetchedResultsControllerDelegate () <NSFetchedResultsControllerDelegate>
@end
@implementation YourNSFetchedResultsControllerDelegate {
UICollectionView *_collectionView;
NSMutableArray *_collectionViewUpdatesQueue;
@matt-curtis
matt-curtis / Resizer.cocoascript.js
Last active August 29, 2015 14:26
Script for use with the default Sketch iOS App Icon Template. Takes the selected layer and duplicates it to the other artboard sizes.
var original = context.selection.firstObject();
var originalArtboard = original.parentArtboard();
var artboards = context.document.artboards();
var enumerator = artboards.objectEnumerator();
var artboard;
while((artboard = enumerator.nextObject())){
if(artboard.isEqual_(originalArtboard)) continue;
@matt-curtis
matt-curtis / export.js
Last active March 11, 2016 18:45
Export Layers in Sketch
var size = [MSExportSize sizeWithScale:4 name:"@4x" format:@"png"];
var exportRequests = [MSSliceMaker slicesFromExportableLayer:selection sizes:[ size ]];
[[MSSliceExporter new] exportSlices:exportRequests];
@matt-curtis
matt-curtis / shape-layer-to-marquee.js
Last active December 3, 2015 16:58
(Sketch) Convert a shape layer to a marquee. Select both bitmap and shape layer and run the plugin.
var document = context.document;
// Find first bitmap and shape in selection
var bitmapLayer = document.selectedLayersOfClass(MSBitmapLayer)[0];
if(!bitmapLayer) return;
var shapeLayer = document.selectedLayersOfClass(MSShapeGroup)[0];
@matt-curtis
matt-curtis / get-unique-user-styling.js
Created November 26, 2016 03:06
Get an element's unique (non-default) styling
var getDefaultStyling = function(tagName){
if(!tagName) tagName = "dummy-tag-name";
// Create dummy iframe
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
// Create element within the iframe's document