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 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
@nuno
nuno / alloy.jmk
Last active September 16, 2015 07:22 — forked from mdpauley/alloy.jmk
alloy.jmk to bump version on build
var fs = require('fs');
var path = require('path');
task("pre:compile", function(event, logger) {
var tiappxml = path.join(event.dir.project, 'tiapp.xml');
var tiapp = fs.readFileSync(tiappxml, {
encoding : 'utf-8'
});
@nuno
nuno / Breakpoints_v2.xcbkptlist
Last active August 29, 2015 14:27 — forked from raven/Breakpoints_v2.xcbkptlist
Symbolic breakpoint for dynamically linking libReveal against UIApplicationMain
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
@nuno
nuno / gist:bd969eac4ab4c2c95733
Last active August 29, 2015 14:25
Using Homebrew to manage Node.js and io.js installs on OSX

Using Homebrew to manage Node.js and io.js installs on OSX

Having both Node.js and io.js installed with NVM was giving me a load of problems, mainly with npm. So I uninstalled NVM and manage Node.js and io.js with homebrew.
Heres how.

Install Node.js and io.js

$ brew install node
$ brew install iojs

@nuno
nuno / verticalScrollableView.js
Created July 24, 2015 16:55 — forked from dawsontoth/verticalScrollableView.js
Vertical Scrollable View
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var rotate = Ti.UI.create2DMatrix().rotate(90);
var counterRotate = rotate.rotate(-180);
var scrollView = Titanium.UI.createScrollableView({
views:[
Titanium.UI.createImageView({ image:'default_app_logo.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_ui.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_views.png', transform: counterRotate })
@nuno
nuno / README.md
Last active February 9, 2017 10:12 — forked from shekibobo/README.md
Android: Base Styles for Button (not provided by AppCompat)

How to create custom button styles using Android's AppCompat-v7:21

Introduction

AppCompat is an Android support library to provide backwards-compatible functionality for Material design patterns. It currently comes bundled with a set of styles in the Theme.AppCompat and Widget.AppCompat namespaces. However, there is a critical component missing which I would have thought essential to provide the a default from which we could inherit our styles: Widget.AppCompat.Button. Sure, there's Widget.AppCompat.Light.ActionButton, but that doesn't actually inherit from Widget.ActionButton, which does not inherit from Widget.Button, so we might get some unexpected behavior using that as our base button style, mainly because Widget.ActionButton strictly belongs in the ActionBar.

So, if we want to have a decently normal default button style related to AppCompat, we need to make it ourselves. Let's start by digging into the Android SDK to see how it's doing default styles.

Digging In