Skip to content

Instantly share code, notes, and snippets.

@yagitoshiro
yagitoshiro / push_notifications.js
Last active August 13, 2016 17:29
apple push notification sample (Titanium Mobile)
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
# Pipe Ars Technica's live Apple event coverage into a Campfire room.
# http://arstechnica.com/apple/news/2010/01/tablet-live-event-liveblog.ars
#
# Usage:
# $ gem install -r hpricot tinder
# $ ruby -rubygems ars_live.rb -ssl mysubdomain myroomid myapikey
require "hpricot"
require "open-uri"
require "tinder"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[JBViewController alloc] initWithNibName:@"JBViewController" bundle:nil];
self.window.rootViewController = self.viewController;
// ADD THIS LINE:
[self.window setTransform:CGAffineTransformMakeScale(0.81, 0.81)];
var win = Titanium.UI.createWindow({
});
var memPool = Titanium.UI.createWindow({});
memPool.open();
memPool.hide();
var memView = Titanium.UI.createView({
size : {
@dawsontoth
dawsontoth / AndroidMenuNavigation.js
Created February 17, 2011 14:23
Menu based navigation in Appcelerator Titanium that supports the use of the "Back" button to go back a view.
// 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
@jkubicek
jkubicek / birds.txt
Last active August 29, 2015 14:02
Print the names of all the birds
Striated Pardalote
Elegant Crested Tinamou
Little Tinamou
Slaty-breasted Tinamou
Thicket Tinamou
Great Tinamou
Chilean Tinamou
Cinereous Tinamou
Brown Tinamou
Greater Rhea
// Source for the Accidental Tech Podcast (ATP) T-Shirt:
// http://www.marco.org/2014/04/29/atp-shirts
//
// By Troy Gaul, June 2, 2014.
//
// Based on Obj-C veresion by Marco Arment, April 28, 2014. MIT license.
// https://gist.github.com/marcoarment/2542cd28cb5df0aa97d8
import UIKit