Skip to content

Instantly share code, notes, and snippets.

View pegli's full-sized avatar

Paul Mietz Egli pegli

View GitHub Profile
@pegli
pegli / gist:4002405
Created November 2, 2012 16:21
styled buttons in a toolbar
var toolbar = Ti.UI.iOS.createToolbar({
bottom: 0,
left: 0,
right: 0,
width: Ti.UI.FILL,
barColor: 'transparent',
translucent: true,
backgroundGradient: {
type: 'linear',
colors: [
@pegli
pegli / gist:4559132
Created January 17, 2013 19:55
widget example

widgets/switchfield/views/widget.xml

<Alloy>
  <TableViewRow id="container">
    <Label id="label"/>
    <Switch id="switchControl" onChange="change"/>
  </TableViewRow>
</Alloy>
@pegli
pegli / app.js
Created January 25, 2013 18:48
app.js wrapper for Ejecta sample code
var webgl = require('appersonlabs.webgl');
var win = Ti.UI.createWindow({
backgroundColor:'#ccc'
});
var canvas = webgl.createCanvasView({
height: Ti.Platform.displayCaps.platformHeight,
width: Ti.Platform.displayCaps.platformWidth,
backgroundColor: 'white'
var styles = require('styles');
// creates { color: 'blue', font: { fontSize: 16 }, textAlign: 'right' }
var usernameLabel = Ti.UI.createLabel(_.defaults({
textAlign: 'right'
}, styles.style_classes.Label, styles.style_ids.username_label));
@pegli
pegli / eventRow.js
Last active December 14, 2015 13:09
var args = arguments[0] || {};
var event = args.event;
var parent = args.parent;
$.addEventListener('swipe', function(e) {
parent.swipe(e);
}
@pegli
pegli / index.tss
Created March 27, 2013 00:24
header/content/footer example
".container": {
backgroundColor:"white"
},
"#header": {
top: 0,
height: 40,
backgroundColor: 'yellow'
},
@pegli
pegli / back.js
Created April 22, 2013 16:51
Alloy page curl animation example
function curlDown(e) {
$.back.close({ transition: Ti.UI.iPhone.AnimationStyle.CURL_DOWN });
}
@pegli
pegli / gist:5447998
Last active December 16, 2015 14:20
couchbase-lite-ios internal replication failure
16:12:24.722| Logging mode 2 enabled in domains: {CBL_Router, CBL_URLProtocol, CBLReplication, ChangeTracker, Sync, SyncVerbose}
16:12:24.725| Sync: ReplicatorManager scanning existing _replicator docs...
16:12:24.751| Sync: ReplicatorManager done scanning.
16:12:29.849| Sync: CBL_Puller[http://lite.couchbase./source/] STARTING ...
16:12:29.849| CBLBasicAuthorizer initWith <http://lite.couchbase./source/>
16:12:29.954| Sync: CBL_Puller[http://lite.couchbase./source/]: Going online
16:12:29.954| Sync: CBL_Puller[http://lite.couchbase./source/]: postProgressChanged (0/0, active=1 (batch=0, net=1), online=1)
16:12:29.954| SyncVerbose: CBL_Puller[http://lite.couchbase./source/]: GET _local/235aa4ef8704428da3bcd63596f7efc7269d840f
16:12:29.957| Sync: CBL_Puller[http://lite.couchbase./source/]: postProgressChanged (0/0, active=1 (batch=0, net=1), online=1)
16:12:29.957| CBLReplication: CBLReplication[from http://lite.couchbase./source/]: mode=3, completed=0, total=0 (changed=1)
@pegli
pegli / MyProxy.java
Last active December 16, 2015 21:59
pass a native function call to a KrollFunction invocation
public void doSomething() {
}
@Kroll.method
public void foogle(KrollFunction callback) {
final MyProxy self = this;
callback.call(this.getKrollObject(), new Object[] {
new KrollFunction() {
public Object call(KrollObject krollObject, Object[] args) {
self.doSomething();
@pegli
pegli / gist:5749878
Created June 10, 2013 15:55
emit doc keys in couchdb map function
function(doc) {
for (var i in doc) {
if (i[0] != '_' && doc.hasOwnProperty(i)) {
emit(parseInt(i), null);
}
}
}