Skip to content

Instantly share code, notes, and snippets.

View etrepum's full-sized avatar
😎
Currently retired

Bob Ippolito etrepum

😎
Currently retired
View GitHub Profile
@etrepum
etrepum / gist:71271
Created February 27, 2009 03:43
tal2genshi.py
#!/usr/bin/env python
"""
Translate the subset of TAL that MochiBot uses to Genshi
* tal:attributes
* tal:content
* tal:replace
* tal:repeat
* tal:condition
pastebin_dropbox(Path) ->
fun ("", _) ->
fun pastebin_devnull/1;
(Filename, _ContentType) ->
Date = fmt_date(date()),
RelName = filename:join([Date,
mochicode:url64_encode(term_to_binary(now())),
filename:basename(Filename)]),
AbsName = filename:join([Path, RelName]),
ok = filelib:ensure_dir(AbsName),
### Eclipse Workspace Patch 1.0
#P voldemort
Index: test/unit/voldemort/versioning/VectorClockTest.java
===================================================================
--- test/unit/voldemort/versioning/VectorClockTest.java (revision 168)
+++ test/unit/voldemort/versioning/VectorClockTest.java (working copy)
@@ -50,8 +50,8 @@
getClock(1).merge(getClock(2)),
getClock(1, 2));
assertEquals("Merging two clocks should be the same as taking the max of their event counts.",
#!/bin/bash
# this sets ERL_FLAGS, ERL_MAX_PORTS, MOCHI_BACKEND_IP, etc.
. /mochi/etc/mochi.conf
exec erl -name `uuidgen`@$MOCHI_BACKEND_IP -remsh $1@$MOCHI_BACKEND_IP
/*
Main.swf: Main.as
mxmlc -use-network -default-size 600 600 Main.as
*/
package{
import flash.display.*;
import flash.text.*;
import flash.events.*;
import mochi.as3.*;
public dynamic class Main extends Sprite
if (_level0 === undefined) {
/* detect AS3 container and patch MovieClip.hitTest */
var realRootForReal = this;
MovieClip.prototype.oldHitTest = MovieClip.prototype.hitTest;
MovieClip.prototype.hitTest = function (x, y, shapeflag) {
if (arguments.length === 1) return this.oldHitTest(x);
var obj = {x: x, y: y};
realRootForReal.localToGlobal(obj);
return this.oldHitTest(obj.x, obj.y, shapeflag);
}
This is at https://www.mochigames.com/accounts/login/ - here's the traceback from Flash MAC 10,0,32,18 (Debug player)
----
Error: Request for resource at https://api.connect.facebook.com/restserver.php?method=users.hasAppPermission by requestor from https://s-static.ak.fbcdn.net/swf/XdComm.swf is denied due to lack of policy file permissions.
*** Security Sandbox Violation ***
Connection to https://api.connect.facebook.com/restserver.php?method=users.hasAppPermission halted - not permitted from https://s-static.ak.fbcdn.net/swf/XdComm.swf
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: https://s-static.ak.fbcdn.net/swf/XdComm.swf cannot load data from https://api.connect.facebook.com/restserver.php?method=users.hasAppPermission.
at XdComm/sendXdHttpRequest()
at Function/http://adobe.com/AS3/2006/builtin::apply()
update(Tag, NewVal, State) ->
NewTree =
case gb_trees:lookup(Tag, State#state.tree) of
{value, Val} ->
X = Val + (NewVal - Val) * 0.01,
gb_trees:update(Tag, X, State#state.tree);
none ->
gb_trees:insert(Tag, NewVal, State#state.tree)
end,
State#state{tree = NewTree}.
$ erl -pa ebin
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:4] [kernel-poll:true]
Eshell V5.7.4 (abort with ^G)
1> mochiweb_util:parse_qs("referrer=http%3A//www.google.co.in/search%3Fclient%3Dsafari%26rls%3Den%26q%3Dexample+wine%26ie%3DUTF-8%26oe%3DUTF-8%26redir_esc%3D%26ei%3DJTC8S8zuE86_rAf0vdWzBw&url=http%3A//www.example.com/&host=www.example.com&flash_version=10,0,32&browser_language=en").
[{"referrer",
"http://www.google.co.in/search?client=safari&rls=en&q=example wine&ie=UTF-8&oe=UTF-8&redir_esc=&ei=JTC8S8zuE86_rAf0vdWzBw"},
{"url","http://www.example.com/"},
{"host","www.example.com"},
{"flash_version","10,0,32"},
$ erl -pa ebin
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:4] [kernel-poll:true]
Eshell V5.7.4 (abort with ^G)
1> Uri = ("/path?"
1> "referrer=http%3A//www.google.co.in/search%3Fclient%3Dsafari"
1> "%26rls%3Den%26q%3Dexample+wine%26ie%3DUTF-8%26oe%3DUTF-8"
1> "%26redir_esc%3D%26ei%3DJTC8S8zuE86_rAf0vdWzBw"
1> "&url=http%3A//www.example.com/&host=www.example.com"
1> "&flash_version=10,0,32&browser_language=en"),