Skip to content

Instantly share code, notes, and snippets.

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

Adam Paxton adampax

🏠
Working from home
View GitHub Profile
@viezel
viezel / build-module-android.sh
Last active August 29, 2015 14:01
Build and copy android module
##
## Build an Appcelerator Android Module
## Then copy it to the default module directory
##
## (c) Napp ApS
## Mads Møller
##
## HOW TO GUIDE
@jasonkneen
jasonkneen / index.js
Created May 15, 2014 14:45
Demonstrate CollapsableView Tag in Alloy.
function collapse(){
$.myView.collapse();
// $.myView.expand();
}
@roccolucatallarita
roccolucatallarita / readme.txt
Created April 7, 2014 21:14
Create route in titanium map module
Create a file in your lib folder, like **rootproject**/lib/routes.map.js
load the module in your file and initialize with the data:
var jsonCoordinates = {
'destination': dest.latitude + ',' + dest.longitude,
'origin': origin.latitude + ',' + origin.longitude,
};
var routes = require("routes.map")(jsonCoordinates, mapview);
@wbroek
wbroek / genymotionwithplay.txt
Last active February 13, 2025 09:37
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@butelo
butelo / callbacks.md
Created January 31, 2014 10:44
Create Callbacks on Android: A Fragment or View makes a Callback to the hosting Activity

Steps to make a Fragment or View to have a Callback to its parent Activity.

Step by step from info taken from here:

http://developer.android.com/guide/components/fragments.html#CommunicatingWithActivity


  • We have an Activity that hosts a Fragment or a View
  • We have a Fragment or View with a ListView or a Button or some element that we want the Activity to know about. i.e. we load detailed info of an element chosen on a ListView or something.
@tonylukasavage
tonylukasavage / Profile.js
Last active January 4, 2016 00:28 — forked from timanrebel/Profile.js
This is essentially what Alloy is doing under the hood for you with backbone
var EVENTS = 'fetch change destroy';
var args = arguments || {};
// remove existing bindings to prevent unexpected behavior and memory leaks
$.user.off(EVENTS);
// add bindings to new model
args.user.on(EVENTS, function() {
$.name.text = args.user.get('name');
@jfromaniello
jfromaniello / gist:8418116
Last active September 19, 2023 23:38
Example of authenticating websockets with JWTs.
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({port: 8080});
var jwt = require('jsonwebtoken');
/**
The way I like to work with 'ws' is to convert everything to an event if possible.
**/
function toEvent (message) {
try {
@ricardoalcocer
ricardoalcocer / themes.md
Last active October 15, 2021 08:10
Changing Android ActionBar Theme and Android Style

Customizing the overall App Style

This guide has been updated for Titanium SDK 3.3.0 which uses AppCompat to bring the ActionBar to Android 2.3.x

Android has a build-in theming system. Using this feature you can easily change the base color Android uses for its controls across your app, allowing you to provide better branding and personalization, while maintaining Android's UI and UX.

Android built-in themes are:

  • Holo (Mostly Black and Cyan)
  • Holo Light (Mostly White and Gray)
@ricardoalcocer
ricardoalcocer / windowopen.js
Last active December 20, 2015 13:59
Dynamically changing menu options on Android
// this goes on the open event of your tabgroup
// what happens here is that you create a single function for the menu options of all tabs
// then upon focus of a tab, you call invalidateOptionsMenu, which triggers the onCreateOptionsMenu event
//
if (OS_ANDROID){
var tabGroup=Alloy.Globals.tabgroup;
var activity = tabGroup.getActivity();
if (activity.actionBar) {
@ricardoalcocer
ricardoalcocer / alloy.jmk
Created July 30, 2013 18:38
Alloy JMK file to transfer Android settings from the tiapp.xml to the Alloy assets folder. The use-case for this is that you can know at runtime which Holo Theme the app is using (if any) and based on this, make UI/UX or graphic decisions like setting colors, images, etc. Next on this idea is an app.tss with pre-defined color for Holo Dark and H…
task("pre:compile",function(event,logger){
var fs = require('fs'),
xml2js = require('xml2js');
var parser = new xml2js.Parser();
parser.addListener('end', function(result) {
var androidSettings=JSON.stringify(result["ti:app"].android[0]);
fs.writeFile(event.dir.project + '/app/assets/holosettings.json', androidSettings, function (err) {
if (err) throw err;