Skip to content

Instantly share code, notes, and snippets.

@lbrenman
lbrenman / index.html
Created November 1, 2014 13:54
Appcelerator Titanium EKG Monitor Example using Logical Labs LE BT Module and Highcharts
<!DOCTYPE HTML>
<!--html manifest="cache.manifest"-->
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highstock Example</title>
<script src="jquery.min.js"></script>
<script src="highcharts.js"></script>
<script src="exporting.js"></script>
@lbrenman
lbrenman / alloy.js
Last active August 29, 2015 14:09
Appcelerator Titanium Alloy Bluetooth LE Weather Station using TI CC2541 SmartTag and Logical Labs BT LE Module
// The contents of this file will be executed before any of
// your view controllers are ever executed, including the index.
// You have access to all functionality on the `Alloy` namespace.
//
// This is a great place to do any initialization for your app
// or create any global variables/functions that you'd like to
// make available throughout your app. You can easily make things
// accessible globally by attaching them to the `Alloy.Globals`
// object. For example:
//
@lbrenman
lbrenman / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lbrenman
lbrenman / app.js
Created March 4, 2015 16:29
Overcoming Cross Site Scripting issue with Node Apps
// initialize app
function start(app, express) {
app.use(express.favicon(__dirname + '/public/images/favicon.ico')); //set favicon
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, x-requested-with, X-Titanium-Id');
res.header('Access-Control-Allow-Credentials', 'true');
next();
@lbrenman
lbrenman / ACS.js
Last active January 18, 2017 13:46
Appcelerator Titanium, Appcelerator mBaaS, Raspberry Pi - Full Stack JavaScript iOT Example to use mobile app to control RPi through mBaaS
var Cloud = require('ti.cloud');
exports.ACSLogin = function(u,p,o){
Ti.API.debug("ACS: ACSLogin()");
if(Titanium.Network.networkType == Titanium.Network.NETWORK_NONE){
alert("No Network. Please try again later.");
if (o.error) { o.error("ACSLogin(): No Network"); };
return;
}
@lbrenman
lbrenman / app.js
Last active August 29, 2015 14:17
ArrowDB Block Example - Sample 'Before' Block to be executed before each API call related to the iotdevice model - clear iot device timer
var Arrow = require('arrow'),
server = new Arrow();
var Timers = require('./timers');
// lifecycle examples
server.on('starting', function(){
server.logger.debug('server is starting!');
});
server.on('started', function(){
@lbrenman
lbrenman / alert.js
Last active August 29, 2015 14:17
ArrowDB Custom APIs Example - Sample custom api's in the apis folder interacting with the same model as the automatic APIs
var Arrow = require('arrow');
var ACS = require('acs-node');
ACS.init(<ACS Key>);
var Alert = Arrow.API.extend({
group: 'iotapis',
path: '/api/alert',
method: 'GET',
description: 'this is an api that shows how to implement an API',
@lbrenman
lbrenman / AccountDetail.js
Last active August 29, 2015 14:19
Appcelerator Arrow Salesforce Composite Connector Models for retrieving Account Details with Associated Opportunities for that Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","AccountDetail",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,
@lbrenman
lbrenman / Account.js
Last active July 2, 2022 15:28
Appcelerator Arrow Post Block to add GPS coordinates to the Salesforce Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","Account",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,
@lbrenman
lbrenman / Account.js
Created May 7, 2015 14:21
Appcelerator Arrow Double Post Block to add GPS coordinates and Local Coffee Shops (via Foursquare) to the Salesforce Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","Account",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,