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 / Quick Build File.as.fdt
Created February 28, 2013 15:48
Quick Build File template for FlashDevelop. Add to "C:\Users\<user>\AppData\Local\FlashDevelop\Templates\ProjectFiles\AS3Project", and see http://www.flashdevelop.org/community/viewtopic.php?f=5&t=10532&p=47487
/**
* Quick Build File: Publish using CTRL+F8
*
* @mxmlc -debug -o bin/$(FileName).swf
*
* Instructions
* ============
*
* All switches should be added to the mxmlc directive above.
*
@davestewart
davestewart / Convert Selected Elements to Library Items.jsfl
Created March 21, 2013 13:14
Converts selected stage elements to library items, including naming and selecting them in the library. Supports shape objects with multiple members.
/**
* Convert selected elements to library items
* @author Dave Stewart
* @url www.xjsfl.com
*/
// variables
var dom = document, timeline, element, names = [], name;
// create a new movieclip in which to do our conversion
@davestewart
davestewart / Check Fonts.jsx
Created May 23, 2013 13:51
PhotoShop Script to check the consistency of fonts in a document
/**
* PhotoShop Script to check the consistency of fonts in a document
* @author Dave Stewart
* @date 23 May 2013
* @url twitter.com/dave_stewart
*/
function checkFonts(fontName)
{
// functions
function checkSet(set)
@davestewart
davestewart / livereload.js
Created May 27, 2013 13:28
jQuery script to defer loading of LiveReload script until the page is ready. Makes for faster initial page load - useful when working with JS templates and SPAs
$(function(){ $('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=2" />').appendTo('head'); });
package text
{
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
/**
* Class to manage a TextField instance and reduce its fontsize to ensure it stays within its original dimensions
* @author Dave Stewart
@davestewart
davestewart / gist:6417396
Created September 2, 2013 21:23
Number patterns
function pad(v)
{
v = String(v);
if(v.length == 1)
{
v = '0' + v;
}
return v;
}
@davestewart
davestewart / list-fonts.jsx
Last active November 17, 2016 12:12
PhotoShop script to list used fonts
/**
* PhotoShop script to list used fonts
* @author Dave Stewart
* @date 23 May 2013
* @url twitter.com/dave_stewart
*/
function listFonts()
{
// functions
function checkSet(set)
@davestewart
davestewart / gist:6917751
Last active December 25, 2015 04:29
CSS technique to scale media proportionally, even in responsive sites, no server-side code or JS needed
/* scale video container proportionally to 16:9 */
.video{
width:100%;
padding-bottom: 56.25%;
position: relative;
float: left;
height: 0;
}
@davestewart
davestewart / htmlDecode.as
Last active December 29, 2015 13:49
International HTML entities replacement function
/**
* International HTML entities decode function
* Works with entity numbers and entity names
*
* modified and simplified from http://www.markledford.com/blog/2009/02/25/as3-htmldecode-htmlencode-xml-hack/
*
* @usage htmlDecode('Hello &amp; w&#233;lcome to &lt;The &Omega; Show&gt;');
* Hello & wélcome to <The Ω Show>
*
* @param value The string to decode
@davestewart
davestewart / heart-domain-unlock.js
Last active August 29, 2015 13:57
Unlock all heart domains from their "list domains" page.
var str = '';
$('a[href^="/domains/"]').each(function(i, e){
var $e = $(e);
var url = $(e).attr('href').replace('index.cgi', 'action.cgi?action=lock_unset');
$(e).attr('href', url);
$.get(url, function(data){
data = data.replace(/^[\s\S]+?<body.+?>|<\/body>[\s\S]+$/g, '');
var $dom = $('<div>').html(data);
str += $dom.find('#yesbox p').text() + '\n';
console.clear();