Skip to content

Instantly share code, notes, and snippets.

View davestewart's full-sized avatar
⚙️
Workin' on Chrome extensions!

Dave Stewart davestewart

⚙️
Workin' on Chrome extensions!
View GitHub Profile
@davestewart
davestewart / gist:3347448
Created August 14, 2012 08:13
JavaScript favelet to set Font Squirrel listing page sample text
javascript:function update(i, e){e = $(e);var src = e.attr('src').replace(/prepend=[^&]+/, 'prepend=' + str);e.attr('src', src);}var str = prompt('Enter sample text:', $.cookie('sample text') || 'The quick brown fox jumped over the lazy dog');if(str){$.cookie('sample text', str); $('img.listing_font_image').each(update);}void(0);
@davestewart
davestewart / jquery.throttle.js
Created October 13, 2012 09:50
jQuery throttle plugin - allows you to call a custom function on an element multiple times without flooding
/*
* Project: jQuery throttle plugin
* Description: Allows you to call a custom function on an element multiple times without flooding
* Author: Dave Stewart
* License: MIT
* Usage: $(element).throttle(function(){console.log(this);}, 'log');
*/
;(function ( $, window, undefined ) {
@davestewart
davestewart / gist:4040049
Created November 8, 2012 16:56
xJSFL inspection of an Arial 40px static textfield containing Hello There
// init
xjsfl.init(this);
clear();
// get the first element
var obj = $('*').get(0);
// inspect properties
// code:
inspect($selection[0].edges, 6, {debug:true}); // debug set to on, so that output breaks if Flash errors
// results:
Inspect: Array (depth:6, objects:16, values:84, time:0.0 seconds)
--------------------------------------------------------------------------------
array => Array
[0] => Edge
@davestewart
davestewart / heart-cleanup.js
Last active December 10, 2015 19:18
Script to clean up the Heart Internet Customer Control Panel (tested in Firefox, using Firebug)
/**
* Script to clean up the Heart Internet Customer Control Panel
*
* See this link for a preview of how the panel looks after a cleanup
* @link http://imgur.com/KJ1JX
*
* Works as a firebug script, or can be minified and run from a bookmarklet
* @link http://fmarcia.info/jsmin/test.html
*
* Panel contents is customisable by editing the 'sections' object
@davestewart
davestewart / optimize.as
Created January 10, 2013 19:07
Function to optimize filters of elements on stage
import flash.display.DisplayObject;
import flash.utils.describeType;
function optimize(element:DisplayObject):void
{
function getFilterType(filter:*):String
{
var xml:XML = flash.utils.describeType(filter);
return String(xml.@name).replace('flash.filters::', '');
}
@davestewart
davestewart / gist:4516020
Last active December 11, 2015 00:19
Publish Hooks class for xJSFL
/**
* Publish Hook class
*
* Features:
*
* - Runs pre and post publish hooks (any file on your hard drive, even other JSFL scripts)
* - Has a simple XUL UI to browse for files
* - Can load and save different profiles, say one for games, one for web
* - Stores setting in an XML config file, but could just as easily store those settings per document using document data
* - Can be set as Active or Inactive should you decide you need to disable it
@davestewart
davestewart / Export Layers To Files.jsx
Last active December 12, 2024 07:12
Updated Photoshop "Export Layers To Files.jsx" with optional numeric prefixing and improved file name formatting
// Copy to: "C:\Program Files (x86)\Creative\Adobe Photoshop CS6\Presets\Scripts" or equivilent on a Mac
// Tested with Photoshop CS6, but should work with older versions. Backup existing files before copying over them!
// Copyright 2007. Adobe Systems, Incorporated. All rights reserved.
// This script will export each layer in the document to a separate file.
// Written by Naoki Hada
// ZStrings and auto layout by Tom Ruark
/*
@@@BUILDINFO@@@ Export Layers To Files.jsx 1.0.0.16
@davestewart
davestewart / Layer Comps To Files.jsx
Last active December 1, 2023 15:47
Updated Photoshop "Layer Comps To Files.jsx" with optional numeric prefixing and improved file name formatting
// Copy to: "C:\Program Files (x86)\Creative\Adobe Photoshop CS6\Presets\Scripts" or equivilent on a Mac
// Tested with Photoshop CS6, but should work with older versions. Backup existing files before copying over them!
// Copyright 2007. Adobe Systems, Incorporated. All rights reserved.
// This script will apply each comp and then export to a file
// Written by Naoki Hada
// ZStrings and auto layout by Tom Ruark
// PNG support by Jeffrey Tranberry
/*
@davestewart
davestewart / gist:4989132
Last active December 13, 2015 23:08
WIP of JSFL class manager for AS3. Below is the class structure of all classes in an existing AS3 project. Future releases may include refactoring and class moving.
+-----------------------------------------------+---------------------------------------------+------------------------------------------------------------------------------------------------------------+
| hierarchy | class path | path |
+-----------------------------------------------+---------------------------------------------+------------------------------------------------------------------------------------------------------------+
| com | | |
| xjsfl | | |