Skip to content

Instantly share code, notes, and snippets.

View nuno's full-sized avatar

Nuno Costa nuno

View GitHub Profile
@nuno
nuno / app.js
Created February 22, 2016 21:46 — forked from someguycrafting/app.js
Titanium ListView (CommonJS) with reponsive orientation changes layout
var countryData = [];
var countrySection;
var countryList;
var maxFetchRows = 20;
var currentListMarker = 0;
var testWin = Titanium.UI.createWindow({
top:20,
var args = arguments[0] || {};var url = "https://api.github.com/search/repositories?q=pushed:>2015-09-01&order=desc";
var page = 1,
loading = false;
function init() {
$.activityIndicator.show();
load(function(items) {
$.list.setItems(transform(items));
$.activityIndicator.hide();
@nuno
nuno / index.js
Created January 14, 2016 15:12 — forked from afranioce/index.js
Appcelerator swipe card like tinder
var win = Titanium.UI.createWindow({
backgroundColor: "#ffffff",
title: "win"
});
// animations
var animateLeft = Ti.UI.createAnimation({
left: -520,
transform: Ti.UI.create2DMatrix({rotate: 60}),
opacity: 0,
@nuno
nuno / index.js
Created January 10, 2016 18:07 — forked from grantges/index.js
Chaining using Appcelerator Titanium / Alloy (Thanks Jason Kneen!)
Alloy.createController(“login”).on(“submit”, function(e) {
doStuffWith(e)
}).getView().open();
@nuno
nuno / app.js
Created January 10, 2016 15:44 — forked from iskugor/app.js
Remove all child elements in Titanium
function removeAllChildren(viewObject){
//copy array of child object references because view's "children" property is live collection of child object references
var children = viewObject.children.slice(0);
for (var i = 0; i < children.length; ++i) {
viewObject.remove(children[i]);
}
}
@nuno
nuno / app.js
Created January 10, 2016 15:35 — forked from iskugor/app.js
Titanium insert after functionality
var win = Ti.UI.createWindow({
backgroundColor: '#39f',
layout: 'vertical'
});
var wrapper = Ti.UI.createView({
layout: 'vertical'
});
var label1 = Ti.UI.createLabel({
@nuno
nuno / InfiniteScrollingTableView.js
Created January 4, 2016 12:15 — forked from dawsontoth/InfiniteScrollingTableView.js
Infinite loading table view for iOS and Android.
/**
* We're going to create an infinite loading table view. Whenever you get close to the bottom, we'll load more rows.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var isAndroid = Ti.Platform.osname === 'android';
/**
* Create our UI elements.
*/
var table = Ti.UI.createTableView({ top: 0, right: 0, bottom: 0, left: 0 });
@nuno
nuno / app.js
Created January 4, 2016 12:12 — forked from dawsontoth/app.js
Swipe for Android plus Vertical Swipes in @appcelerator #titanium
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
/**
* Adds "swipe" event support to Android, and adds swipe up and down to iOS.
* @param view The view that should be made swipeable.
* @param allowVertical Whether or not vertical swipes (up and down) are allowed; default is false.
* @param tolerance How much further you need to go in a particular direction before swipe is fired; default is 2.
*/
function makeSwipeable(view, allowVertical, tolerance) {
tolerance = tolerance || 2;
@nuno
nuno / README.md
Created November 6, 2015 14:42 — forked from lbrenman/README.md
Arrow Web Scraping Example using x-ray

Arrow Web Scraping

Web scraping is technique of extracting information from websites. For mobile applications, it should be considered a last resort. Instead try to get access to the inderlying data via a documented REST web service API.

However, you may find that an REST or SOAP API is not available and you may need to web scrape in order to get the web site data into your mobile application.

If you are going web scrape, then don't do it in the mobile app. Instead, use a microservices platform, like Arrow. By implementing the screen scraping in an Arrow middle tier server, then when the web site changes, you can change your scraping algorithm without needing to publish a new mobile application.

This blog post will show a simple example of using Arrow Builder to build an API that utilizes web scraping.

@nuno
nuno / UICollectionView+ReloadItemsAnimated.h
Last active September 20, 2015 16:47 — forked from mipstian/UICollectionView+ReloadItemsAnimated.h
UICollectionView category to disable animation on reloadItemsAtIndexPaths:
#import <UIKit/UIKit.h>
@interface UICollectionView (ReloadItemsAnimated)
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths animated:(BOOL)animated;
@end