Skip to content

Instantly share code, notes, and snippets.

triceam / fibonacci.js
Last active Dec 21, 2016
OpenWhisk Fibonacci Action
View fibonacci.js
var sequence = [1];
var invocations = 0;
function main(args) {
invocations = 0;
var int = parseInt(args.num);
//num is a zero-based index
View OpenWhisk-npm
var openwhisk = require('openwhisk’);
function main(params) {
var wsk = openwhisk({ignore_certs: true})
//do stuff
triceam / index.cfm
Created Apr 24, 2013
Code from my live editing w/ server side languages in Adobe Edge Code/Brackes screencast
View index.cfm
<link href="index.css" rel="stylesheet" />
triceam / gist:4978360
Created Feb 18, 2013
Simple HTML DOM Charts
View gist:4978360
<!DOCTYPE html>
<title>HTML DOM Chart</title>
border: 1px solid black;
View gist:4954842
Answered Questions (39)
1. Steven Erat: I see that the Cordova project creation script lands some Jasmine Unit Testing code under {project}/www/spec/lib/jasmine1.2.0. This implies Jasmine UT is baked in, yet I can't find a definitive doc about getting started with UT for PhoneGap apps, with the exception of Adobe's Fil Maj whose blog links some presentations he's given about it. What would you recommend for unit testing PG apps? I've also found a blog on Ripple UT for PhoneGap.
* Raymo: As far as I know, the UTs that ship with Cordova are assuming you have your own test runner. I'm not necessarily sure we expect 'regular' folks (grin) to actually use them. To answer your second question about UTs and PG in genera, I think Jasmine would work great, and perhaps even Selenium. It isn't something I've used yet myself (with PG), but I'd imagine it would work the same as a desktop web app. (Or near close enough.)
2. Shawn Flanagan: As a new PhoneGap user, I have found it rather difficu
triceam / gist:4658021
Created Jan 28, 2013
Detecting PhoneGap/Ripple emulator via JavaScript
View gist:4658021
myFunction( param ) {
var emulated = window.tinyHippos != undefined;
if ( emulated ){
//do something specific to emulated environment;
///do something else...
triceam / gist:4558113
Last active Dec 11, 2015
Transcript from Open Session on PhoneGap 01/17/2012
View gist:4558113
Q: I need to pay to upload my app at the google play store or necesary i need to buy a google dev account?
A: Yes, while PG is free, you have to pay Google (and Apple, and MS) for a Dev Account. Google is cheap though - I think 20 bucks.
Q: lukas: i would like to ask when we use google maps api v3 in phonegap app, is there any way to do it a little bit faster? cause we are experiencing performance problems and for example caching of the maps area i have already seen is not functional
A: We do not control the Google Maps API. However, you can use any 3rd party javascipt API. I (Andy) have had a lot of success using Leaflet with Open Street Maps, however this is not the exact same API as Google. There isn't necessarily a technical reason that the Google API would not work, since it is contained within a webview.
To add to this - you can also use the Google Static Maps API. It doesn't allow zooming/panning, but it returns maps as simple graphics.
Q: if i make a php document on Dreamweaver can i get a p
triceam / gist:3502658
Created Aug 28, 2012
Open Session on PhoneGap QA Transcript
View gist:3502658
Answered Questions (78)
1. Steven Benjamin: How can I configure a splash screen, I am using PG 2.0.0 for Android.?
* Piotr Walczyszyn: You do it in Java code, here is snippet of my code:
public class MyGapActivity extends DroidGap
* Piotr Walczyszyn(privately): This line does the trick: super.setIntegerProperty("splashscreen", R.drawable.splash);
and you put your splash in drawable/{RES}/splash.png
triceam / index.html
Created Aug 20, 2012
JavaScript Templating Example to show rendering techniques of JS data in HTML or XML formats.
View index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<title>JSON Transform</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<link href="" rel="stylesheet"></link>
triceam / gist:2570291
Created May 1, 2012
Form factor detection in JavaScript (tablet vs phone) w/ jQuery
View gist:2570291
var _w = Math.max( $(window).width(), $(window).height() );
var _h = Math.min( $(window).width(), $(window).height() );
// assume tablet view based upon display resolution
var tabletView = (_w >= 1000 && _h >= 600);
if ( tabletView ) {
//Setup the tablet form factor via JS
else {