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
// See an updated version of this in it's own git repo: | |
// http://github.com/dandean/Ajax.JSONRequest | |
/* JSON-P implementation for Prototype.js somewhat by Dan Dean (http://www.dandean.com) | |
* | |
* *HEAVILY* based on Tobie Langel's version: http://gist.github.com/145466. | |
* Might as well just call this an iteration. | |
* | |
* This version introduces: | |
* - onCreate and onFailure callback options. |
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
/** | |
* class RuntimeIframe (or Ajax.IFrame, or something... ) | |
**/ | |
var RuntimeIframe = Class.create({ | |
/** | |
* new RuntimeIframe(options); | |
* - options (Object): Configuration options; currently limited to `width` and `height` | |
* | |
* Creates a new `RuntimeIframe`. | |
**/ |
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
/** | |
* Number#between(low, high[, inclusive = false]) -> boolean | |
* - low(Number): Number must be greater than `low` value | |
* - high(Number): Number must be less than `high` value | |
* - inclusive(Boolean): [Optional] Include low and high numbers in the check. | |
* Defaults to `false`. | |
* | |
* Checks if the Number is between `low` and `high` values. Returns `true` or `false` | |
**/ | |
Number.prototype.isBetween = function(low, high, inclusive) { |
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
/** | |
* class Person | |
* | |
* An example use case for Number.MIN_VALUE and Number.MAX_VALUE. | |
**/ | |
var Person = Class.create((function() { | |
var _age = Number.MIN_VALUE, _name; | |
return { | |
/** | |
* new Person(name[, age]); |
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
/** | |
* class Guid | |
**/ | |
var Guid = Class.create((function() { | |
var _value; | |
return { | |
/** | |
* new Guid(value); | |
* | |
* - value ([[String]]): Valid guid-formatted string. |
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
// Comparison in JavaScript is an interesting thing... | |
var Object1 = { | |
toString: function() { return "!!!"; } | |
}; | |
var Object2 = { | |
toString: function() { return "!!!"; } | |
}; |
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
// This has been taken further here: | |
// http://github.com/dandean/shouter/tree/master | |
/** | |
* mixin Watchable enables sproutcore-style property watching... kinda. | |
* todo: - unwatch | |
* - allow property modification before setting | |
* - revisit naming | |
* - examples with UI elements | |
* - investigate potential performance issues |
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
/** | |
* class Color | |
**/ | |
var Color = Class.create((function() { | |
function _testFormatSupport(format) { | |
var el = document.createElement("span"); | |
var oldColor = el.style.color = "red"; | |
try { | |
el.style.color = format; |
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
module ApplicationHelper | |
# `smart_link_to` is an *exact* copy of `link_to`, with some added functionality. | |
# I would rather simply call `link_to` and then add in my bits, but I don't know | |
# how to proxy `call_to` with the given arguments. | |
def smart_link_to(*args, &block) | |
if block_given? | |
options = args.first || {} | |
html_options = args.second |
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> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>test3</title> | |
<script type="text/javascript" charset="utf-8" src="_ui/js/lib/prototype.js"></script> | |
<script type="text/javascript" charset="utf-8" src="_ui/js/lib/s2.js"></script> | |
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script> | |
<script type="text/javascript" charset="utf-8" src="_ui/js/application.js"></script> | |
</head> |
OlderNewer