Skip to content

Instantly share code, notes, and snippets.

View boardmain's full-sized avatar

samuele coppede boardmain

View GitHub Profile
@alanleard
alanleard / gist:1278595
Created October 11, 2011 16:26
PageFlip with Pinch/Zoom
var win = Ti.UI.currentWindow;
Titanium.PageFlip = Ti.PageFlip = require('ti.pageflip');
var pdf = 'http://assets.appcelerator.com.s3.amazonaws.com/docs/Appcelerator-IDC-Q1-2011-Mobile-Developer-Report.pdf';
var fileName = pdf.split('/').pop();
var pdfFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, fileName);
function downloadPDF() {
var progressBar = Ti.UI.createProgressBar({ max: 1, min: 0, value: 0, visible: true });
win.add(progressBar);
@aaronksaunders
aaronksaunders / app.js
Created December 21, 2011 04:37
posting data with attachment to couchdb using iriscouch and appcelerator
//
// blog.clearlyinnovative.com
// Aaron K. Saunders
// Clearly Innovative Inc
//
var database_url = "http://greenlyyt.iriscouch.com/movie_store/";
var user_name, password;
/** ----------------------------------------------------------------------------
@myersjustinc
myersjustinc / README.md
Created May 25, 2012 20:54
Convert HTML image map to SVG

This takes an HTML document that contains a client-side image map ( and elements) and creates an SVG image based on the shapes described in the image map (since SVG's a more general-purpose format than the HTML image map).

The HTML document doesn't necessarily have to be well-formed XML (there's a fallback to the BeautifulSoup parser for documents with some weirdness in them), which might be useful.

Dependencies

  • lxml
  • Python (of course)
@chrisjdavis
chrisjdavis / gist:4046787
Created November 9, 2012 16:48
Passbook server API
<?php
class PassAPI extends Plugin
{
# Registration
# register a device to receive push notifications for a pass
#
# POST /v1/devices/<deviceID>/registrations/<typeID>/<serial#>
# Header: Authorization: ApplePass <authenticationToken>
# JSON payload: { "pushToken" : <push token, which the server needs to send push notifications to this device> }
#
@rampicos
rampicos / social.js
Last active January 10, 2019 10:10
Social.js is the Appcelerator Titanium's Alloy Widget at first it is used to connect with Twitter only, though twitter and linkedin uses OAuth for its authentication I made some changes on Social.js for multi-purpose to connect Twitter and LinkedIn
function hex_sha1(s) {
return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
}
function b64_sha1(s) {
return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
}
function str_sha1(s) {
return binb2str(core_sha1(str2binb(s), s.length * chrsz));
@stephenfeather
stephenfeather / parse.js
Last active May 28, 2024 15:03
Quick library for using the Parse REST API within Appcelerator's Titanium. Building it out as I need different pieces of the API.
// Copyright Stephen Feather and other contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
@aaronksaunders
aaronksaunders / corrected_sql.js
Created January 5, 2013 19:17
Working with model ids when creating sync adapters in BackboneJS | Appcelerator Alloy. This is not just specific to the sql adapter, but should be considered when creating your own custom adapters
function Sync(model, method, opts) {
var table = model.config.adapter.collection_name, columns = model.config.columns, resp = null;
switch (method) {
case "create":
// properly set the model id on object
// and on the model.attributes notice use of 'idAttribute'
// property to account for something other than 'id' being
// used to store the actual attribute
if (!model.id) {
model.id = guid();
@grantges
grantges / alloy.js
Last active December 12, 2015 07:48
Quick code snippets to easily set up a background task to poll geolocation information on iOS on a 10 second interval
// Setup Geoloaction Background Tasks for the app
Ti.Geolocation.purpose = "This app would like to use your location.";
Ti.App.iOS.registerBackgroundService({url: "geoBackgroundTask.js"});
/**
* Note: If you are programming in a standard project for Titanium,
* this snippet would probably go in your app.js file
* /
//
// See Slidedeck for more information
//
// http://www.slideshare.net/aaronksaunders/parse-appcelerator-titanium-the-easy-way-jan2013
//
// Aaron K Saunders
// Clearly Innovative Inc
//
// twitter : @aaronksaunders
// blog : blog.clearlyinnovative.com
@rblalock
rblalock / handleItemSwipe.js
Last active November 18, 2017 19:16
TableViewRow swipe sample
/**
* Handle Item Swipe
* @param {Object} _event
*/
$.handleItemSwipe = function(_event) {
var row = _event.source;
var id = row.id;
var controls = Alloy.createController("rowControls");
row.add(controls.wrapper);