Skip to content

Instantly share code, notes, and snippets.

View viezel's full-sized avatar

Mads Møller Schrøder viezel

View GitHub Profile
@viezel
viezel / app.js
Created July 24, 2012 21:15 — forked from dawsontoth/app.js
Customize the look of the tab bar in iOS Appcelerator Titanium
Ti.include('overrideTabs.js');
/*
This is a typical new project -- a tab group with three tabs.
*/
var tabGroup = Ti.UI.createTabGroup();
/*
Tab 1.
@viezel
viezel / NappSQL
Created October 8, 2012 19:10
Napp SQL for Alloy Framework
/*
* Napp Framework
* (c) 2012 Napp ApS
* www.napp.dk
*
* NAPP SQL ALLOY ADAPTER
* Dual SQLite/SQL sync adapter which will store all models in
* an on device database
*/
@viezel
viezel / CommonJS example
Last active December 10, 2015 23:19
CommonJS example
//method 1: minklasse.js
function MinKlasse(args){
function hejsa(){
return 1;
}
return {
hejsa:function(){
return 1;
@viezel
viezel / behave restsql test
Last active December 12, 2015 07:38
behave restsql test v2
//Setup module to run Behave tests
require('behave').andSetup(this);
describe('SQLREST: create a model', function() {
it.eventually('*** creates a new model', function(done) {
var model = Alloy.createModel('wine', {
name : "CHATEAU LE DOYENNE",
year : 2012,
grapes : "Merlot",
country : "France",
@viezel
viezel / Collections.js
Created February 16, 2013 21:21
Alloy bug: Global collection is overriding others?
var collection = Alloy.Collections.collection;
var openAddItem = function(){
var win = Alloy.createController("CollectionDetail").getView();
win.open();
}
function dataTransform(model) {
var transform = model.toJSON();
transform.title = transform.first + " " + transform.last;
migration.up = function(db) {
db.createTable({
"columns": {
"id":"INTEGER PRIMARY KEY AUTOINCREMENT",
"userid":"INTEGER",
"title":"text",
"description":"text",
"image":"text",
"thumb":"text",
"modules":"text",
@viezel
viezel / db.js
Created February 23, 2013 14:41
custom sql migration
function executeSql (sql, data) {
if(data != undefined && data.length > 0) {
var final_sql = sql;
for(var value in data) {
final_sql = final_sql.replace(sqlSeperator, '"' + escapeSql(data[value]) + '"');
}
return db_instance.execute(final_sql);
} else {
return db_instance.execute(sql);
@viezel
viezel / alloy.js
Created April 1, 2013 15:37
Getting FontAwesome icons as Titanium Window BackButtonTitle
Alloy.Globals.fontAwesome = require('IconicFont').IconicFont({
font: 'FontAwesome'
});
Alloy.Globals.fontAwesomeBackButton = Alloy.Globals.fontAwesome.icon('icon-chevron-left');
var NappAppearance = require('dk.napp.appearance');
NappAppearance.setGlobalStyling({
barButton:{
color:"#ffffff",
shadowColor: "transparent",
@viezel
viezel / app.js
Last active June 15, 2020 19:13
Codebird for Appcelerator Titanium. Using the Twitter API 1.1
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
@viezel
viezel / NappUI.js
Last active December 19, 2015 16:38 — forked from raulriera/NappUIHack.js
// We need to add the following proxies to our project before Napp UI works.
// This is due to some limitations of the Titanium Module SDK
// Please run this after you require the
exports.initNappUI() {
require('dk.napp.ui'); // require the module
// window and tabs