This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function repr(v) { | |
print(uneval(v)) | |
} | |
repr(false) | |
//-> false | |
repr(true) | |
//-> true | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jsonp.js for Protototype | |
* | |
* Copyright (c) 2009 Tobie Langel (http://tobielangel.com) | |
* | |
* jsonp.js is freely distributable under the terms of an MIT-style license. | |
*-------------------------------------------------------------------------- | |
Requires: Prototype >= 1.6 | |
Usage: | |
new Ajax.JSONRequest('http://api.flickr.com/services/feeds/photos_public.gne', { | |
onComplete: function(json) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.observe('click', function(event) { | |
var element = event.findElement('a.quickdetails'); | |
if (!element) { return; } | |
var href = element.readAttribute('href'), | |
m = href.split('/'); | |
if (m.length < 3) { return; } | |
new Ajax.Request('/VacancyInfo', { | |
method: 'get', | |
parameters: { id: m.last() }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<script type="text/javascript" charset="utf-8"> | |
document.addEventListener('resize', function() { throw 'resized!' }, false); | |
var event = document.createEvent('HTMLEvents'); | |
event.initEvent('resize', true, false); | |
document.documentElement.dispatchEvent(event); | |
// should throw a "resized!" error. No longer does in FF > 3.5 | |
// https://bugzilla.mozilla.org/show_bug.cgi?id=503244 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Untested. Requires Prototype >= 1.6 | |
// | |
// Copyright (c) 2009 Tobie Langel | |
// | |
// 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Untested. Requires Prototype >= 1.6 | |
// | |
// Copyright (c) 2009 Tobie Langel | |
// | |
// 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Untested. Requires Prototype >= 1.6 | |
// | |
// Copyright (c) 2009 Tobie Langel | |
// | |
// 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prototype.Selector.select(<String: selector>[, <Node: scope=document>]) -> [Element...] | |
Prototype.Selector.match(<Node: element>, <String: selector>) -> Boolean | |
Prototype.Selector.filter(<Iterable: elements>, <String: selector>) -> [Element...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/Desktop/src/ | |
cd ~/Desktop/src/ | |
curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip | |
unzip rhino1_7R2.zip | |
mkdir ~/Library/Java/ | |
mkdir ~/Library/Java/Extensions/ | |
cp ~/Desktop/src/rhino1_6R5/js.jar ~/Library/Java/Extensions/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testEmile: function(testcase) { | |
var element = document.getElementById('test_basic'); | |
testcase.assertEqual('0px', element.style.left); | |
testcase.pause(); | |
emile(element, 'left:300px', { | |
onComplete: function() { | |
testcase.resume(function() { | |
testcase.assertEqual('300px', element.style.left); | |
}); | |
} |