Skip to content

Instantly share code, notes, and snippets.

View pegli's full-sized avatar

Paul Mietz Egli pegli

View GitHub Profile
var c = require('window_view_controller').createController();
@pegli
pegli / view.js
Last active August 29, 2015 13:58
function do_something(e) {
if (e.source.type == 'a') {
// something specific to a
}
else if (e.source.type == 'b') {
// something specific to b
}
}
$.index.open();
@pegli
pegli / question.js
Created September 29, 2014 20:34
fetching relations in Alloy model
extendModel: function(Model) {
_.extend(Model.prototype, {
answers: function() {
var coll = Alloy.createCollection('answer');
coll.fetch({ query: 'select * from answers where question_id = ' + this.get('id')});
return coll;
},
});
return Model;
}
@pegli
pegli / app.js
Created October 1, 2014 20:13
Ti webview eventing
var win = Ti.UI.createWindow();
var webview = Ti.UI.createWebView({
url: 'local.html'
});
var button = Ti.UI.createButton({
title: 'fromTitanium',
height: '50dp',
width: '130dp'
});
button.addEventListener('click', function(e) {
@pegli
pegli / child.js
Last active August 29, 2015 14:14
Alloy WebView example
$.win.open();
function webviewLoad() {
alert("loaded");
}
function loadGoogle() {
$.webview.url = "http://google.com/";
}
@pegli
pegli / readme.md
Created February 12, 2015 17:20
Getting back to node 0.10 on homebrew

The Titanium CLI isn't compatible with node 0.12 (TIMOB-18538). If you use homebrew and have already upgraded to 0.12, you can go back to 0.10.36 by running the following commands:

cd $( brew --prefix )
git checkout b64d9b9 Library/Formula/node.rb
brew unlink node
brew install node

You might want to use brew pin node to keep brew upgrade from updating that formula until the CLI is fixed.

Keybase proof

I hereby claim:

  • I am pegli on github.
  • I am pegli (https://keybase.io/pegli) on keybase.
  • I have a public key whose fingerprint is 1766 EA7E 3933 251A CACE 7827 3BEA 9CE8 8856 8305

To claim this, I am signing this object:

@pegli
pegli / gist:969694
Created May 12, 2011 23:46
missing top-level objects on Android
// module code
// assets/Resources/foogle.js
exports.client = {
test: function() {
var modules = ["Accelerometer","Analytics","Android","App","Contacts","Database","Facebook","Filesystem","Geolocation",
"Gesture","Locale","Map","Media","Network","Platform","UI","Utils","XML","Yahoo"];
for (var i = 0; i < modules.length; i++) {
Titanium.API.info(modules[i]+ "? "+Titanium[modules[i]]);
}
}
@pegli
pegli / gist:996326
Created May 27, 2011 22:31
XPath namespace declaration and routeContext
<!-- xpathFilterWithNamespace.xml from existing camel-spring test case; works fine -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:foo="http://example.com/person"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">