Skip to content

Instantly share code, notes, and snippets.

View manumaticx's full-sized avatar
👌
i'm okay

Manuel Lehner manumaticx

👌
i'm okay
View GitHub Profile
@falkolab
falkolab / README.md
Last active July 18, 2017 22:35
How to use latest Alloy with appc CLI

If you want to use latest alloy with appc CLI command:

  1. Update Alloy: [sudo] npm install -g alloy

  2. Create file in your project <project root>/plugins/global.alloy/1.0/hooks/global_alloy_hook.js with content:

exports.init = function (logger, config, cli, appc) {
	delete process.env.ALLOY_PATH;
};
@lbrenman
lbrenman / MyUser.js
Last active November 27, 2017 23:10
Appcelerator Arrow Two Factor Authentication
var Arrow = require("arrow");
var Model = Arrow.createModel("MyUser",{
"fields": {
"username": {
"type": "String",
"required": true
},
"password": {
"type": "String",
@falkolab
falkolab / momentLang.js
Last active February 11, 2016 10:11
Set Moment locale to the Titanium SDK Ti.Locale.currentLocale
var moment = require('alloy/moment');
// First add languages that support your application
var languages = ['ru', 'nl', 'fr', 'fr-ca'];
// Full language list: https://github.com/appcelerator/alloy/tree/master/Alloy/builtins/moment/lang
// You must explicit way to require language files in order to compiler saw their.
require('alloy/moment/lang/ru');
require('alloy/moment/lang/nl');
require('alloy/moment/lang/fr');
@jasonkneen
jasonkneen / elements.js
Last active November 28, 2016 14:26
In the latest TiAlloy you can specify a module tag against the <Alloy> element in XML and this will be used when creating any elements in the view, so you can override, customise etc. The problem is if you want to use multiple commonJS libraries, there's no support in the Alloy Tag -- you'd have to change the module attribute for each element --…
var o = {};
// include the modules you want - purposely did this as seperate lines so it's easier to comment out modules etc
_.extend(o, require("module1"));
_.extend(o, require("module2"));
_.extend(o, require("module3"));
// make available under a single export for use in <Alloy> tag
module.exports = o;
@lbrenman
lbrenman / SalesByRegion.js
Created May 23, 2015 21:44
Appcelerator Arrow Totals Row and KPI Calculation using custom field and getter and a block
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.mysql/table1","SalesByRegion",{
"fields": {
"rid": {
"type": "number",
"required": false,
"optional": true,
"readonly": false,
"writeonly": false
@DaveHudson
DaveHudson / Grunt-Installr
Created July 11, 2014 06:32
Grunt.js + Installr API
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
installr_settings: {
releaseNotes: grunt.file.read("./CHANGELOG.txt")
},
titanium: {
build_ios: { // build for ios first
@jasonkneen
jasonkneen / index.js
Last active March 15, 2017 18:51
Demo of how to use David Bankier's "Real Switch" for Android here. https://github.com/dbankier/RealSwitch. Add the Module to your TiApp.xml file, add a switch to your Alloy file as normal, but add the module attribute. Drop the ui.js file into your /lib/ folder (you can add to this) and then run the project. On iOS you'll get a regular iOS switc…
$.mySwitch.addEventListener('change',function(e){
Ti.API.info('Switch value: ' + $.mySwitch.value);
});
@tonylukasavage
tonylukasavage / app.js
Created June 2, 2014 14:51
Inject environment variables into Titanium. Makes shared code easier to manage (no more sanitizing keys in repos). Uses Titanium to encrypt the values.
// now you can use it in a titanium app
useSomeApi(Ti.App.Properties.getString('SOME_API_KEY'));
@viezel
viezel / build-module-android.sh
Last active August 29, 2015 14:01
Build and copy android module
##
## Build an Appcelerator Android Module
## Then copy it to the default module directory
##
## (c) Napp ApS
## Mads Møller
##
## HOW TO GUIDE