Skip to content

Instantly share code, notes, and snippets.

View sharpred's full-sized avatar

Paul Ryan sharpred

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / gist:9069190
Created February 18, 2014 11:26
main.js change
(function() {
var Tabletop = require('tabletop');
var wrench = require('wrench');
var public_url = "https://docs.google.com/spreadsheet/pub?key=0ArTqrFjFwISadGI4anRRZlM4UGZrcjNTMTJ0OWsydkE&output";
var builder = require('xmlbuilder');
var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var cwd;
@sharpred
sharpred / gist:13cda452cab8348ef635
Created June 5, 2014 09:55
performs jshint on files in your commit
#!/bin/sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$files" = "" ]; then
exit 0
fi
pass=true
echo "\nValidating JavaScript:\n"
@sharpred
sharpred / productBiscuits
Created September 15, 2014 14:40
productBiscuits
var images = {
"productBiscuits" : {
"boat" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/73B98337448B4A8B9F51888A7C7A8318/boat_73B98337448B4A8B9F51888A7C7A8318.png?AWSAccessKeyId=AKIAJKGCNZBGAX5FSCSQ&Expires=1725974249&Signature=%2Bew8AKJLxzIs8C6HgBCmp2jsHUQ%3D",
"camper" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/6B9CE162196A4455A77D128EAA9DF04D/camper_6B9CE162196A4455A77D128EAA9DF04D.png?AWSAccessKeyId=AKIAJKGCNZBGAX5FSCSQ&Expires=1725974407&Signature=r0CqD4bc%2BzBPZZmMfMT2IICL%2Fl0%3D",
"car" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/5031ADD80C014B16B7455B9132B6E998/car-hire_5031ADD80C014B16B7455B9132B6E998.png?AWSAccessKeyId=AKIAJKGCNZBGAX5FSCSQ&Expires=1725974445&Signature=2W8ix1a27Cit4rVvbvDGAzJsUcY%3D",
"extra" : "https://s3.amazonaws.com/razuna-server-tui/A3BCD0D5F6B7414BBDC94B5D505AC601/img/0906F231770D416EAAD822F8ADFB2821/extras_0906F231770D416EAAD822F8ADFB2821.pn