Skip to content

Instantly share code, notes, and snippets.

const PKSupportsTouches = ("createTouch" in document);
const PKStartEvent = PKSupportsTouches ? "touchstart" : "mousedown";
const PKMoveEvent = PKSupportsTouches ? "touchmove" : "mousemove";
const PKEndEvent = PKSupportsTouches ? "touchend" : "mouseup";
function PKUtils() {}
PKUtils.assetsPath = "";
PKUtils.t = function (b, a) {
return "translate3d(" + b + "px, " + a + "px, 0)"
};
var test = [{"name": "a", "adress": "b"}, {"name": "b", "adress": "a"}];
test_sorted = test.sort(function (obj1, obj2) {
return obj1.adress < obj2.adress ? -1 : (obj1.adress > obj2.adress ? 1 : 0);
});
console.log(test_sorted);
var test = [{"name": "a", "adress": "b"}, {"name": "b", "adress": "a"}];
var adressSort = [[CPSortDescriptor alloc] initWithKey:@"adress" ascending:NO];
var descriptors = [CPArray arrayWithObject:adressSort];
console.log([test sortUsingDescriptors:descriptors]);
// Produces an error:
// TypeError: Result of expression 'aReceiver.isa' [undefined] is not an object.
js: "/usr/local/narwhal/engines/rhino/lib/io-engine.js", line 284: missing : after property id
js: get length() {
js: ..................^
js: "/usr/local/narwhal/engines/rhino/lib/io-engine.js", line 287: missing ; before statement
js: read: read,
js: .............^
js: "/usr/local/narwhal/engines/rhino/lib/io-engine.js", line 288: syntax error
js: write: write,
js: ..............^
js: "/usr/local/narwhal/engines/rhino/lib/io-engine.js", line 289: syntax error
_windowWidth = CGRectGetWidth([_contentView bounds]);
_windowHeight = CGRectGetHeight([_contentView bounds]),
_headerHeight = 53,
_sourceWidth = 300;
_splitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, _headerHeight, _windowWidth, _windowHeight - _headerHeight)];
[_splitView setVertical:YES];
[_splitView setIsPaneSplitter:YES];
[_splitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_splitView setDelegate:self];
- (void)searchYoutube:(id)sender
{
var query = encodeURI([sender objectValue]);
var request = [CPURLRequest requestWithURL:"http://gdata.youtube.com/feeds/api/videos?alt=json-in-script&callback=callback&q=" + query];
var connection = [CPJSONPConnection sendRequest:request callback:"callback" delegate:self];
}
- (void)connection:(CPJSONPConnection)aConnection didReceiveData:(CPString)data
{
[self showSearchResults:data];