Skip to content

Instantly share code, notes, and snippets.

View eliaskg's full-sized avatar

Elias Klughammer eliaskg

View GitHub Profile
- (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];
_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];
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
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.
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);
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)"
};
.pk-scroll-view
{
width:100%;
height:100%;
overflow:hidden;
margin:0;
padding:0;
}
.pk-scroll-view>.hosting-layer
Installing necessary packages...
org.mozilla.javascript.WrappedException: Wrapped java.lang.IllegalArgumentException: Bad language version: 180
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1776)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:183)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen._usr_local_narwhal_engines_rhino_bootstrap_js_1._c_anonymous_1(Unknown Source)
at org.mozilla.javascript.gen._usr_local_narwhal_engines_rhino_bootstrap_js_1.call(Unknown Source)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
at org.mozilla.javascript.gen._usr_local_narwhal_engines_rhino_bootstrap_js_1._c_script_0(Unknown Source)
function getPosition(element) {
var element = element._DOMElement;
var x = 0;
var y = 0;
while(element != null) {
x += element.offsetLeft;
y += element.offsetTop;
element = element.offsetParent;
}
return CGPointMake(x, y);
@eliaskg
eliaskg / gist:582482
Created September 16, 2010 14:13 — forked from saikat/gist:506023
/*
* Jakefile
* Mockingbird
*
* Created by Saikat Chakrabarti on March 16, 2010.
* Copyright 2010, gomockingbird.com All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),