Skip to content

Instantly share code, notes, and snippets.

View iskugor's full-sized avatar

Ivan Škugor iskugor

View GitHub Profile
#!/usr/bin/env bash
OUT=`${ANDROID_SDK_ROOT}/platform-tools/adb shell getprop init.svc.bootanim`
RES="stopped"
while [[ ${OUT:0:7} != 'stopped' ]]; do
OUT=`${ANDROID_SDK_ROOT}/platform-tools/adb shell getprop init.svc.bootanim`
echo 'Waiting for emulator to fully boot...'
sleep 5
done
// v1.1.4. https://github.com/viezel/NappDrawer/tree/master/ios/dist
var rootWin = Ti.UI.createWindow({
backgroundColor: "#ccc"
});
rootWin.addEventListener('click', function() {
var NappDrawerModule = require("dk.napp.drawer");
{
"items":[
{
"type":"news",
"objectId":"F49BVNva6n",
"campus_id":"MYmJJGwRz8"
},
{
"type":"news",
"objectId":"R3SAI9ZVAJ",
@iskugor
iskugor / keys.js
Created November 14, 2013 18:20
Get unique keys in nested object
function getKeys(obj) {
var keys = Object.keys(obj);
keys.forEach(function(val) {
if (obj[val] instanceof Object) {
keys = keys.concat(getKeys(obj[val]));
}
});
return keys;
}
@iskugor
iskugor / alloy.js
Created November 14, 2013 11:30
Alloy "isTablet" that detects iPad mini
Alloy.isTablet = Alloy.isTablet || (Ti.Platform.model.search(/ipad/i) > -1);
@iskugor
iskugor / localStorage.js
Last active December 28, 2015 06:09
Use parse.com JS API in Titanium mobile
module.exports = {
getItem : function(_key) {
return Ti.App.Properties.getObject(_key);
},
setItem : function(_key, _value) {
return Ti.App.Properties.setObject(_key, _value);
},
removeItem : function(_key, _value) {
return Ti.App.Properties.removeProperty(_key);
}
@iskugor
iskugor / gist:5023996
Created February 24, 2013 14:13
Carbon framework feature request
var win = Ti.UI.createWindow();
var button = Carbon.UI.create(win, '{ "children": { "Button": { title: "This is button" }} }');
@iskugor
iskugor / gist:3990081
Created October 31, 2012 21:41 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@iskugor
iskugor / app.js
Created October 23, 2012 13:53
Titanium "once" function
function once(component, eventName, callback) {
if(component && component.addEventListener && eventName && callback) {
var wrappedCallback = function(e) {
component.removeEventListener(eventName, wrappedCallback);
callback.call(component, e);
};
component.addEventListener(eventName, wrappedCallback);
} else {
Ti.API.error('"once" function illegal parameter');
}
@iskugor
iskugor / app.js
Created August 24, 2012 14:03
Titanium atomic boomb :)
# run on Android
var i = 0;
var win = {
backgroundColor: '#000',
__TiElement: null,
__getTiElement: function() {
if (!this.__TiElement) {
this.__TiElement = Ti.UI.createWindow(this);