Skip to content

Instantly share code, notes, and snippets.

View sharpred's full-sized avatar

Paul Ryan sharpred

View GitHub Profile
@sharpred
sharpred / samplepush.json
Last active August 29, 2015 13:56
Push Notification. This is a sample push notification payload file that Creator will send to registered devices
{
"title": "External Link Example (Get)",
"alert": "Sample Alert",
"icon": "little_star",
"badge": "+1",
"sound": "circus.wav",
"vibrate": false,
"callToAction": {
"action": "B",
"uri": "http: //www.example.com",
@sharpred
sharpred / qxhr.create.js
Created August 9, 2013 10:43
qxhr.create
qxhr.create(conn).then(function(data) {
//do something here
}, function(error) {
//handle the error here
});
@sharpred
sharpred / pickerb4.js
Created June 3, 2013 13:27
this picker throws a cast exception on android
erfPicker = require('ui/common/fragments/erfPicker').create({
data : erfData,
callBack : function(e) {
var selection = e.selectedValue[0] || 1;
erfButton.title = selection;
}
});
@sharpred
sharpred / picker.js
Last active December 18, 2015 00:38
issue with using integer in a picker
erfPicker = require('ui/common/fragments/erfPicker').create({
data : erfData,
callBack : function(e) {
var selection = '' + (e.selectedValue[0] || 1);
erfButton.title = selection;
}
});
@sharpred
sharpred / index.html
Created January 26, 2013 16:59
dementia scrapbook index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<title>Dementia ScrapBook</title>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Metrophobic' rel='stylesheet' type='text/css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
@sharpred
sharpred / BG.js
Created October 16, 2012 08:11
background service
/*global L */
/*jslint nomen: true, sloppy : true, plusplus: true, vars: true, newcap: true*/
/**
* Background Services. File and data uploads as well as claim status updates are all processed
* using the background services. They feed off items written to the dataqueue table by the UI
* during normal operation. The background service is sandboxed from the main app therefore there is
* a degree of code duplication here with copies of functions used elsewhere in the app duplicated here.
* @module bgService
*/
//TODO refactor all these helper functions as commonJS so we can remove all the duplicated code.
@sharpred
sharpred / updateFilesMetadata.php
Created July 18, 2012 13:23
mongo update attachments metadata
<?php
$mongoDB = new Mongo();
$database = $mongoDB->selectDB("BVS");
$collection = $database->createCollection('fs.files');
$search = array("metadata.formdata.claimid" => "4");
$replace = array('$set'=>array("metadata.formdata.mynewfield" => "wibble")); // note use of single quotes around $set. This is compulsory
$multiple = array("multiple" => true); // used to update all records that match default is false (update first record only)
$collection->update($search, $replace, $multiple);
?>
@sharpred
sharpred / howrwejson.js
Created June 1, 2012 12:55
howrwe getjson
$(function() {
$(document).ready(function() {
$.getJSON('howrwe.json', function(chartvalues) {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'bar'
},
tooltip: {
formatter: function() {
@sharpred
sharpred / howrweajax.js
Created June 1, 2012 12:53
howrwe json callback
/*global $ Highcharts */
$(function () {
$(document).ready(function () {
$.ajax({
url: 'http://www.stepupsoftware.co.uk/howrwe.json',
method: 'GET',
async: false,
success: function (chartvalues) {
var chart = new Highcharts.Chart({
chart: {
@sharpred
sharpred / getMongoAttachment.php
Created May 23, 2012 12:00
retrieve mongo attachment data, iterate through and retrieve each file
<?php
$mongoDB = new Mongo();
$database = $mongoDB->selectDB("BVS");
$collection = $database->createCollection('fs.files');
//to get the attachments metadata back
$query = array("metadata.formdata.claimid" => "SUS14052012-001");
// $items is a cursor of mongodata
$items = $collection->find($query);
//iterate through the collection and retrieve the named file
$grid = $database->getGridFS();