Skip to content

Instantly share code, notes, and snippets.

View nuno's full-sized avatar

Nuno Costa nuno

View GitHub Profile
@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
Created April 19, 2016 12:10 — forked from grantges/index.js
Cleaning Up Subviews in Appcelerator Titanium
$.index.open();
var subViews = [];
function _doSomething(){
alert('Something!');
}
@nuno
nuno / README.md
Last active May 31, 2020 06:21 — forked from grantges/README.md
Titanium TSS for Transparent NavigationBar / Shadow on iOS

Creating a transparent NavigationBar using Titanium Style Sheets

Appcelerator Titanium offers many ways to style the navigation bar for iOS apps, from changing out the title view all together, or just using simple colors. However, one of the most frequent requests I hear is how to make a truly transparent NavigationBar. This tutorial will cover that.

Getting started

Lets start with a pretty simple window style in the app.tss. This will ensure that the window style is applied globally.

Note: This can be used in a specific controller *.tss file if you only want this effect on a particular window.

import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.Scroller;
/**
* @author androidseb
@nuno
nuno / Readme.md
Created April 5, 2016 15:56 — forked from grantges/Readme.md
Shapes With Appcelerator Titanium and Hyperloop

Custom Alloy Tags based on Appcelerator Hyperloop modules

With Alloy and Hyperloop, you can quickly and easily expose native UI as Custom Alloy tags by leveraging the namespace (ns) attribute and commonjs modules.

Alloy allows you to create your own UI element that can be included into the XML View heirarchy in one of two ways, an Alloy Widget or through the use of Custom Tags.

To create your own custom tag, you link the tag to the commonjs module with the namespace attribute (ns). Here is an example using a custom tag to render a standard Titanium View:

@nuno
nuno / resetAllSimulators.sh
Created March 29, 2016 16:25 — forked from ZevEisenberg/resetAllSimulators.sh
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all