Skip to content

Instantly share code, notes, and snippets.

View gbaldera's full-sized avatar
🏠
Working from home

Gustavo Rodriguez Baldera gbaldera

🏠
Working from home
View GitHub Profile
import os, re, argparse
app_path = os.path.split(os.path.split(__file__)[0])[0]
PROJECT_ROOT = os.path.abspath(app_path)
regexps = [
(r'class=(["\'] *?)row-fluid( *?["\']+)', r'class=\1row\2'),
(r'class=(["\'] *?)brand( *?["\']+)', r'class=\1navbar-brand\2'),
(r'class=(["\'] *?)nav-collapse( *?["\']+)', r'class=\1navbar-collapse\2'),
(r'class=(["\'] *?)nav-toggle( *?["\']+)', r'class=\1navbar-toggle\2'),
public class EndlessScrollListener implements OnScrollListener {
private int visibleThreshold = 20;
private int currentPage = 0;
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
@Override
package some.awesome.package;
import it.sephiroth.android.library.imagezoom.ImageViewTouch;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class ImageViewTouchViewPager extends ViewPager {
var TiParse = function(options) {
// need to convert this to requires
Ti.include("parse-1.2.7.js");
Parse.localStorage = {
getItem : function(_key) {
return Ti.App.Properties.getObject(_key);
},
setItem : function(_key, _value) {
@gbaldera
gbaldera / app.js
Created July 30, 2013 17:06 — forked from pec1985/app.js
var win = Ti.UI.createWindow();
var images = [];
for(var i = 1; i < 100; i++){
// Assuming all the images are called image1.jpg, image2.jpeg, etc...
images.push('/images/image'+i+'.jpg');
}
var gallery = Gallery(images,0);
/*jslint maxerr:1000 */
var my = {tools:{}};
//Import our module into our project
my.tools.cardHelper = require('credit_card_helper');
//Our test credit card number that we got from http://www.getcreditcardnumbers.com/
var testCreditCardNumber ="49713268648235453";
//Call our verify method to check if our credit card number is in a correct format
var ccCheck = my.tools.cardHelper.verifyCardWithLuhn(testCreditCardNumber);
//alert the result back to the user
alert(ccCheck);
/*
Learn the basics of Storekit with this example.
Before we can do anything in our app, we need to set up iTunesConnect! This process can be a little painful, but I will
guide you through it so you don't have to figure it out on your own.
Follow these steps:
1) Log in to your Apple Developer account at https://itunesconnect.apple.com/
2) Click "Manage Your Applications".
// this is your app.js
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// define our main window and open it. it will be an activity (navBarHidden: true), and will control our child window views
Titanium.UI.createWindow({
navBarHidden: true,
backgroundColor: '#fff',
url: 'mainwindow.js',
exitOnClose: true
/**
Create Thumbnail of Video File
This snippet captures a thumbnail JPG image, based on a frame @ 2 second time-lapse.
Titanium Mobile
*/
var movie = Titanium.Media.createVideoPlayer({
contentURL:FILENAME,

I wanted a intelligent library that pops the "Rate my app" question at the right time and is easy to set-up.

Well, this library at minimum requires no configuration at all and takes just a single line of code, because it reads your app's (bundle) ID from Ti.App.id and looks up the App Store ID itself:

require('rate').plus();

Check out advanced.js for all available options.

I personally like to add points at places where the user has positive interaction with the app, but wait to pop the question until he/she is finished doing that.