Skip to content

Instantly share code, notes, and snippets.

View ewanharris's full-sized avatar

Ewan Harris ewanharris

View GitHub Profile
@ewanharris
ewanharris / Tiapp Permissions.md
Last active June 25, 2021 12:09
Download and update an APK in Titanium

Add the below to your tiapp

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1">
      <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    </manifest>
 
@ewanharris
ewanharris / IMPORT.md
Last active March 10, 2020 11:40 — forked from FokkeZB/IMPORT.md
Add support for @import to Alloy styles

@import TSS for Alloy

NOTE: This is out-dated, I suggest using https://github.com/dbankier/ltss instead.

This alloy.jmk adds support for using CSS-like @import "file.tss"; statements in Alloy TSS styles.

The idea for this came when discussing adding the option of including a CSS-like reset stylesheet in Alloy to make up for platform differences in (background)color, but also some good practices.

I think one of the key issues in this discussion is that there is no such thing as the base style for an app. iOS fans would like to reset to iOS-like styles, Android fans like to reset to theirs, flat UI fanatics would like everything minimalized and Bootstrap adepts will ask for a huge library of styles.

@ewanharris
ewanharris / text.md
Created July 25, 2019 14:55
Debugging iOS connection for debugger
  1. With the simulator launched, lookup the simulator socket
    • lsof -aUc launchd_sim
  2. Look for a name that ends in com.apple.webinspectord_sim.socket, copy that.
  3. Spawn ios_webkit_debug_proxy passing in that socket prefixed with unix:
    • ios_webkit_debug_proxy -s unix:<socket from step 2>
    • It should output something like the below
$ios_webkit_debug_proxy -s unix:/private/tmp/com.apple.launchd.y7tX5zeZ81/com.apple.webinspectord_sim.socket
Listing devices on :9221
@ewanharris
ewanharris / app.js
Created June 29, 2018 15:12
Require URI and ID issue on iOS
const json = require('./jsonfile.json');
console.log(json);
console.log(json.id);
const foo = require('./foo');
console.log(foo);
console.log(foo.id);
const win = Ti.UI.createWindow({
backgroundColor: 'white'
});
@ewanharris
ewanharris / app.js
Created August 29, 2017 13:28
ti.barcode example + permissions
/**
* In this example, we'll use the Barcode module to display some information about
* the scanned barcode.
*/
var Barcode = require('ti.barcode');
Barcode.allowRotation = true;
Barcode.displayedMessage = ' ';
Barcode.allowMenu = false;
Barcode.allowInstructions = false;
Barcode.useLED = true;
@ewanharris
ewanharris / app.js
Created August 23, 2017 11:14
XAML Style tests
var win = Ti.UI.createWindow({ backgroundColor: 'white' });
var lbl = Ti.UI.createLabel({text: 'label', top: 0});
var btn = Ti.UI.createButton({title: 'button', top: 50});
var sb = Ti.UI.createSearchBar({top: 150});
var view = Ti.UI.createView({top:250, width: 100, height: 100});
var style = Ti.UI.Windows.createStyle({ source: 'ms-appx:///Style.xaml' });
style.apply(lbl, 'LabelStyle');
style.apply(btn, 'ButtonStyle');
style.apply(view, 'ViewStyle');
style.apply(sb, 'SBStyle')