Skip to content

Instantly share code, notes, and snippets.

View nuno's full-sized avatar

Nuno Costa nuno

View GitHub Profile
@nuno
nuno / rating.js
Created September 8, 2016 14:06 — forked from chmiiller/rating.js
A draggable and swipeable 5 stars rating view for Android and iOS
var win = Ti.UI.createWindow({
backgroundColor:'#eeeeee'
});
var isAndroid = Ti.Platform.osname == "android";
var starSelectedImage = '/images/ic_star_black.png';
var starOriginalImage = '/images/ic_star_border_black.png';
//icons from Google Material Design (search for the "star" icon): https://design.google.com/icons/
var starWidth = 28;
var coverView = Ti.UI.createView();
@nuno
nuno / generateSplash.js
Created August 27, 2016 13:01 — forked from dawsontoth/generateSplash.js
Start with a 1000x1000 PSD with an icon in the middle. In Photoshop select File > Scripts > Browse... generateSplash.js. Saves out to ../Resources/iphone and android.
/*
Define our various sizes.
*/
var AndroidSizes = {
'android/images/res-ldpi/splash.9.png': 240,
'android/images/res-mdpi/splash.9.png': 360,
'android/images/res-hdpi/splash.9.png': 480,
'android/images/res-xhdpi/splash.9.png': 720,
'android/images/res-xxhdpi/splash.9.png': 960,
'android/images/res-xxxhdpi/splash.9.png': 1440
@nuno
nuno / Using Xcode 7.3.1 and iOS 10 devices
Last active June 20, 2016 15:11 — forked from steipete/ios-xcode-device-support.sh
Using Xcode 7.3.1 and iOS 10 devices
// The trick is to copy the DeviceSupport folder from the beta to the stable version.
cp -r /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.0\ \(14A5261u\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
// Then restart Xcode. You might need to do that for every beta of iOS 10/Xcode 8.
@nuno
nuno / sticky-table-headerview.js
Created June 16, 2016 13:27 — forked from tzmartin/sticky-table-headerview.js
Titanium Sticky Header
// just a quick n dirty test. See result: http://monosnap.com/file/wT6dJZ4zOrHzjiXi1mhfnIocEZiAWW
var headerView = Ti.UI.createView({
backgroundColor:'#fff',
height:80,
layout:'horizontal'
});
headerView.add(Ti.UI.createButton({title:'$100',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
headerView.add(Ti.UI.createButton({title:'$500',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
@nuno
nuno / promise.js
Created June 16, 2016 13:26 — forked from nazrdogan/promise.js
Titanium + Q promise
var Q = require("q");
function Promise(name) {
var defer = Q.defer();
setTimeout(function() {
defer.notify('About to greet ' + name + '.');
if (name) {
defer.resolve('Hello, ' + name + '!');
@nuno
nuno / x.js
Last active June 16, 2016 13:12 — forked from nazrdogan/x.js
Events Controllers extend BackBone.Events and as such can dispatch events.
<!--
Events
Controllers extend BackBone.Events and as such can dispatch events.
For example, our index view could also require another controller to deliver the label and listen to an event:
-->
app/views/index.xml
<Alloy>
<Window class="container">
<Require id="label" src="label" onNotify="doSomething" />
</Window>
function atualizarFunc(event){
// Codigo para reiniciar toda a table aqui
// Use o hide para "terminar" o pull to refresh
requisicaoXHR({
refresh: event
});
}
function carregarMais(event){
requisicaoXHR({
  • First you need to remove the current version of appc-cli alloy.

~/.appcelerator/install/For CLI Version/package/node_modules/

delete the folder alloy

  • Go back to package folder and edit package.json file

change the alloy version from ~1.8.0 to 1.9.0

@nuno
nuno / README.md
Created May 14, 2016 16:06 — forked from falkolab/README.md
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;
};
@nuno
nuno / index.js
Last active April 24, 2016 14:39
Test case scrollableView
/**
*
* 1 - Create a new alloy project and paste this code on index.file file.
*
* 2 - On index.xml file delete all code, and paste: <Alloy /> tag
*
* 3 - Run and test, and look at the dots of (showPagingControl) to see the creation time :)
*
*/