The RoLLing cOde

Rumor, crap and –un–original

Archive for the ‘Crap’ Category

URL Handler and Bookmarklet for The Hit List

without comments

This app will handle x-thl:// links and add task to your inbox of
The Hit List

The bookmarklet will use title of web page as title of the task and pick page url and selected text as notes.

THL URL Handler.app.zip
- unpack to Applications folder of your Mac

Send to THL
- Drag to bookmark bar of your favourite browser 

If you’d like to write your own bookmarklet, here’s the template:




position
=optional



only inbox is supported at this stage,
i’ll consider if add support for start/due and specify a project in THL some time later.


Mar 25, 2009 - App updated!

Newly supports:

  • optional position parameter ( beginning or end )
  • inbox can be any project or even folder1/folder2/project

Enjoy!

Written by freewizard

March 22nd, 2009 at 9:59 pm

Posted in Crap

Tagged with

Script Entourage messages to The Hit List

without comments

The Hit List
is a good task management software for Mac OSX, and I think it’s better than
OmniFocus
and
Things
.

 120 then
			set theNotes to get text 1 through 120 of theNotes
			set theNotes to theNotes & "..."
		end if
		tell application "GrowlHelperApp" to notify with name "New Email" title (theTitle) description (theNotes) application name "Entourage Growl Notifier" priority 0 sticky no icon of application "The Hit List"
	end repeat
end tell
]]>

To use this as a mail rule, in Entourage, open menuToolsRules, add a new rule with “Run AppleScript” as its action.

To use this as a menu item or hotkey script, copy the script to

/Documents/Microsoft User Data/Entourage Script Menu Items/

, it’ll appear in the Script menu of Entourage.You can even add a
cT
after it’s name so that it will be triggered when you press Ctrl-T. 

Written by freewizard

March 18th, 2009 at 9:30 am

Posted in Crap

Tagged with ,

Bulk edit in redmine-0.7.x

without comments

for those who stick to redmine-0.7, apply this to make its bulk-edit rework in Firefox/Safari.


backported from trunk.

Written by freewizard

January 4th, 2009 at 6:28 am

Posted in Crap

Tagged with

Detect ActionScript 2/3 in TextMate

without comments

I made
a very rough tmplugin
(TM 1.x OSX 10.4+ UB) to search the word “package” in the beginning of first 20 lines of .as file to determine whether it’s AS3 or AS2, then select a proper bundle. It’s modified from
TabMate
.

You should have
ActionScript
and
ActionScript 3
tmbundle before install this tmplugin. 

Written by freewizard

December 12th, 2008 at 7:07 am

Posted in Crap

Tagged with ,

Growl notification for 1G1G.com

without comments

It’s a
Fluid
SSB user script.

// ==UserScript==
// @name        1G1G
// @namespace   http://fluidapp.com
// @description Show Growl notification when song changes
// @include     *
// @author      freewizard gmail.com
// ==/UserScript==

(function () {
    if (window.fluid) {
        window.lastTitle = "亦歌-自由自在听音乐";
        setInterval(function() {
            if (document.title == window.lastTitle) return;
            window.lastTitle = document.title;
            window.fluid.showGrowlNotification({
                title: "亦歌",
                description: window.lastTitle,
                identifier: "www.1G1G.com"
            });
        }, 1000);
    }
})();

Written by freewizard

December 8th, 2008 at 3:38 pm

Posted in Crap

Tagged with

Quick filter by mail topic in Microsoft Entourage

without comments

This script will filter mails by topic ( actually subject without “Re:” and “Fw:” ) of the selected message.

Save the following AppleScript code as ~/Documents/Microsoft User Data/Entourage Script Menu Items/Quick FiltercF

on ltrim(someText)
	repeat until first character of someText is not in {" ", tab, ASCII character 10, return, ASCII character 0}
		set someText to text 2 thru -1 of someText
	end repeat
	return someText
end ltrim

on run
	tell application "Microsoft Entourage"
		--activate
		set msgs to the current messages
		if msgs is {} then return
		repeat with msg in msgs
			set subj to get the subject of msg
		end repeat
		set AppleScript's text item delimiters to {":"}
		set tpc to last text item of subj
	end tell
	set tpc to my ltrim(tpc)
	set the clipboard to tpc
	tell application "System Events" to tell process "Entourage"
		delay 0.1
		keystroke tab
		delay 0.1
		keystroke "v" using command down
		keystroke tab
	end tell
end run

Make sure quick filter is turned on (Cmd-Shift-L);

Click one item in the messages list;

Click script menu and select our script.

Written by freewizard

October 23rd, 2008 at 9:43 am

Posted in Crap

Tagged with

Show unread mails in Skype mood text

without comments

Run the following AppleScript code in Entourage as incoming mail rule and/or scheduled task:


Written by freewizard

October 21st, 2008 at 5:58 am

Posted in Crap

Tagged with ,

Cross-domain classes in ActionScript 2.0

without comments

Yes, you are right that we still live in a world with ActionScript 2.0 somewhere.

As described by
Adobe
, content loaded from different domains belong to different sandboxes, and you can make them communicate to each other by calling System.security.allowDomain(”*”).

However, this only permits you calling methods in the swf from the other domain, not the class definitions. In order to create an instance of a class from the other domain, you have to:

// http://domain1/a.swf
_global["Tier"] = _root._parent.GetClassTier();
var t = new Tier();

and

// http://domain2/b.swf
class Tier {
 //...
}
function GetClassTier() {
 return _global.Tier;
}

Ok, now you are able to create a cross-domain instances. Then what about extending from a cross-domain class? The key is letting b.swf to load from a “proxy” class.

// http://domain3/c.swf
class Hund extends Tier {
 //...
}

and

// http://domain3/c_proxy.swf
_global["Tier"] = mc._parent.GetClassTier();
// call MovieClipLoader to load c.swf here

The reason you must have a proxy is bc AVM1 executes class definition in initClip stage when the loadee MovieClip is not available yet to access the loader MovieClip. If you try to extend from a class which was not in _global yet, it will never get a proper super value.

It’s ugly that you have to do such hack, while not so bad ‘cz you’re survived!

Written by freewizard

September 8th, 2008 at 11:58 am

Posted in Crap

Tagged with

Cross-domain bug inside ActionScript 2.0

without comments

I believe it’s a bug: you turned off security check, it still tells you there’s a security violation when two swf read varibles from each other in certain way; however you end up finding that’s only a warning, you can still do it as is.

a.fla:

import System.security;
System.security.allowDomain("*");
function onLoadInit( mc:MovieClip ){
 mc.test({test:"test"});
}
mcl = new MovieClipLoader();
mcl.addListener( this );
mcl.loadClip( "http://127.0.0.1/b.swf?"+Math.random(),
 this.createEmptyMovieClip( "_container", this.getNextHighestDepth() ) );

b.fla:

import System.security;
System.security.allowDomain("*");
function test(o) {
 trace("test func");
 for(var i in o) { // violation happen here before any trace() below
 trace(i);
 }
}

Type http://localhost/a.swf, now you’ll get the buggy dump in log.In fact, there are an other couple of way to reproduce this, such as read/write an undefined member in a cross-domain object.

Written by freewizard

September 4th, 2008 at 6:15 am

Posted in Crap

Tagged with

This blog has been switched to AppEngine

without comments

Google rocks!

Written by 72pines

August 31st, 2008 at 11:02 am

Posted in Crap