Skip to content

Instantly share code, notes, and snippets.

View nuno's full-sized avatar

Nuno Costa nuno

View GitHub Profile
@nuno
nuno / .htaccess
Created February 18, 2014 15:37 — forked from sergejmueller/.htaccess
Extension of the Apache system. Htaccess file for browser-based delivery of WebP instead of JPEG image files. Especially for WordPress. More information about WebP and the snippet shown below http://cup.wpcoder.de/webp-jpeg-alternative/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
[
{"id":830,"start":1262279460,"end":1262281260,"title":"this is a long event isnt that righttt","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":831,"start":1262282052,"end":1262283852,"title":"830","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":832,"start":1262284644,"end":1262286444,"title":"831","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":833,"start":1262287236,"end":1262289036,"title":"832","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":834,"start":1262289828,"end":1262291628,"title":"833","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":835,"start":1262292420,"end":1262294220,"title":"834","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":836,"start":1262295012,"end":1262296812,"title":"835","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":837,"start":1262297604,"end":1262299404,"title":"836","body":"","multi":0,"allDay":false,"extension_id":2},
{"id":838,"start":"2014-03-06T14:30:00.000Z","end":"2014-03-06T16:00:00.000
@nuno
nuno / app.js
Created April 18, 2014 22:48 — forked from dawsontoth/app.js
Loading images in @appcelerator #Titanium
/* The images for this example can be downloaded from http://j.mp/loadingimagesforti */
var win = Ti.UI.createWindow({ backgroundColor: '#f00'});
var loading = Ti.UI.createImageView({
images: [
'images/loading/00.png', 'images/loading/01.png', 'images/loading/02.png',
'images/loading/03.png', 'images/loading/04.png', 'images/loading/05.png',
'images/loading/06.png', 'images/loading/08.png', 'images/loading/09.png',
'images/loading/10.png', 'images/loading/11.png'
],
width: 33, height: 33
@nuno
nuno / tracer.js
Created May 12, 2014 15:58 — forked from jeffbonnes/tracer.js
A tracer object to Titanium Mobile to show elapsed time and memory usage
var tracer = {};
(function() {
tracer.levels = {};
tracer.levels.DEBUG = 1;
tracer.levels.INFO = 2;
tracer.levels.WARN = 3;
tracer.levels.ERROR = 4;
tracer.levels.OFF = 5;
tracer.allTracers = [];
@nuno
nuno / ti-resize
Created May 12, 2014 21:02 — forked from kopiro/ti-resize
ti-resize
#!/bin/bash
# How to install
# curl https://gist.github.com/kopiro/8859612/raw -o /usr/local/bin/ti-resize
# How to use
# Put all your assets @2x in your $TITANIUM_PROJECT/assets
# Open Terminal
# ti-resize (in your Titanium Project directory)
@nuno
nuno / app.js
Created July 6, 2014 01:28 — forked from exclusiveTanim/app.js
Change the button states(Android & iOS)
/*
Hello, I have tested this issue in Ti SDK 3.3.0.RC. Its working good.
Testing Environment:
Titanium SDK: 3.3.0.RC, 3.2.3.GA
Titanium CLI: 3.2.3
IOS Simulator 7.1
Appcelerator Studio, build: 3.3.0.201406271159
*/
@nuno
nuno / app.js
Created July 6, 2014 01:34 — forked from exclusiveTanim/app.js
Expendable row
/*
Hello, I have tested this issue in Ti SDK 3.3.0.RC. Its working good.
Testing Environment:
Titanium SDK: 3.3.0.RC, 3.2.3.GA
Titanium CLI: 3.2.3
IOS Simulator 7.1
Appcelerator Studio, build: 3.3.0.201406271159
*/
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
installr_settings: {
releaseNotes: grunt.file.read("./CHANGELOG.txt")
},
titanium: {
build_ios: { // build for ios first
@nuno
nuno / titanium-mixpanel.js
Created August 9, 2014 14:23 — forked from gmccullough/titanium-mixpanel.js
This is a little CommonJS library I put together for adding Mixpanel tracking to an iOS and Android Appcelerator Titanium app I built. YMMV. I'm sharing it since I hadn't seen anything similar, and Mixpanel rocks. There are no native dependencies. All Mixpanel API calls are made by using the HTTP specification (https://mixpanel.com/docs/api-docu…
// The currentUser lib stores a model representing the logged in user, and other login state information
var currentUser = require('currentUser');
// Logger is a Ti.API.info() wrapper with a bit more flexibility
var logger = require('logger');
var messageQueue = []; // put this into local storage at some point to retain recent offline events before crashes
var messageInTransit = null;
var token = Ti.App.Properties.getString('mixpanel.token');
var systemProperties = {
mobile_osname: Ti.Platform.osname,