Skip to content

Instantly share code, notes, and snippets.

View benjamn's full-sized avatar

Ben Newman benjamn

View GitHub Profile
@benjamn
benjamn / gist:1123597
Created August 3, 2011 19:46
load dynamic script with callback
function fetch(src, callback) {
var script = document.createElement(nodeName),
called;
try {
script.addEventListener("load", callback, false);
} catch (x) {
script.attachEvent("onreadystatechange", function() {
if (!called && /loaded|complete/.test(script.readyState) {
called = true;
callback();
@benjamn
benjamn / LICENSE.txt
Created May 28, 2011 05:54 — forked from jed/LICENSE.txt
use anchor tags to parse URLs into components
Copyright (c) 2011 Jed Schmidt, http://jed.is
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
function getFrame() {
var frame,
frames = window.parent.document.getElementsByTagName("iframe");
for (var i = 0; frame = frames[i]; ++i)
if (frame.contentWindow === window)
return frame;
}
diff --git a/web/lib/a/schema_defs.py b/web/lib/a/schema_defs.py
index bfcb336..530e8fb 100644
--- a/web/lib/a/schema_defs.py
+++ b/web/lib/a/schema_defs.py
@@ -4091,4 +4091,37 @@ defs = [
ENGINE=InnoDB DEFAULT CHARSET=utf8''', 'log_db'),
(868, '''ALTER TABLE flagged_flash_client_ids ADD INDEX(time)''', 'log_db'),
+
+ # Avoid errors updating due to limited text column sizes.
def js_init(self):
- (js_cls, js_data) = a.view.dialog.Dialog.js_init(self)
- js_data['default_text'] = self.default
- js_data['click_expand'] = self.click_expand
- js_data['mobile'] = self.mobile
-
- return ("QuestionAdd", js_data)
+ data = a.view.dialog.Dialog.js_init(self).get('data', {})
+ data['default_text'] = self.default
+ data['click_expand'] = self.click_expand
function finish() {
this.$("#@test_link").addClass(this._failed ? "done_effed_up" : "done");
Harness.instance.finish();
}
(function() {
function action() {
// Whatever you want to do.
alert("came back");
}
// In case the page gets reloaded upon coming back.
if (/#redirected$/.test(location.href)) {
action();
return;
In file included from /home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.cpp:1:
/home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.h: In member function ‘virtual void mozilla::_ipdltest::TestLatencyParent::ActorDestroy(mozilla::ipc::IProtocolManager<mozilla::ipc::AsyncChannel::AsyncListener>::ActorDestroyReason)’:
/home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.h:42: error: ‘class mozilla::TimeDuration’ has no member named ‘ToSecondsSigDigits’
/home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.h:43: error: ‘class mozilla::TimeDuration’ has no member named ‘ToSecondsSigDigits’
/home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.cpp: In member function ‘void mozilla::_ipdltest::TestLatencyParent::Main()’:
/home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.cpp:34: error: ‘Resolution’ is not a member of ‘mozilla::TimeDuration’
/home/ben/dev/mozilla-1.9.2/ipc/ipdl/test/cxx/TestLatency.cpp: In member function ‘virtual bool mozilla::_ipdltest::TestLatencyParent::RecvPong()
~/dev/multi-jetpack/obj-ff-debug % make -C js/jetpack/tests xpcshell-tests
make: Entering directory `/home/ben/dev/multi-jetpack/obj-ff-debug/js/jetpack/tests'
/usr/bin/python2.6 -u /home/ben/dev/multi-jetpack/config/pythonpath.py \
-I/home/ben/dev/multi-jetpack/build \
/home/ben/dev/multi-jetpack/testing/xpcshell/runxpcshelltests.py \
--symbols-path=../../../dist/crashreporter-symbols \
../../../dist/bin/xpcshell \
../../../_tests/xpcshell/test_jetpack/unit
^CTEST-PASS | /home/ben/dev/multi-jetpack/obj-ff-debug/_tests/xpcshell/test_jetpack/unit/test_jetpack.js | test passed
#include <iostream>
using std::cout;
using std::endl;
int main() {
// Make the struct immutable so that public access is safe.
const struct AutoFoo {
~AutoFoo() {
// On destruction, do something with the members.
cout << x << ", " << y << endl;