Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View milankarunarathne's full-sized avatar
:octocat:
Coding

Milan Karunarathne milankarunarathne

:octocat:
Coding
View GitHub Profile
@milankarunarathne
milankarunarathne / ES6_Singlet.js
Last active February 10, 2017 13:10
Create Singleton pattern using ES6
'use strict';
/**
* Created by Milan Karunarathne
* Email: mhkarunarathne@gmail.com
* May be freely distributed under the MIT license
*/
import EventEmitter from 'events';
class Single extends EventEmitter {
@milankarunarathne
milankarunarathne / git_extract_commits.sh
Last active September 9, 2015 18:14 — forked from xinan/git_extract_commits.sh
This is a simple shell script to extract commits by a specified author in a git repository and format them as numbered patches. It is useful for GSoC code submission.
if ! [[ $# -eq 1 || $# -eq 2 || $# -eq 4 ]]; then
echo "Usage: $0 <author> [<start_date> <end_date>] [output_dir]"
echo "Example: $0 xinan@me.com 2015-05-25 2015-08-21 ./patches"
exit
fi
author=$1
if [ $# -gt 3 ]; then
output_dir=$4
@milankarunarathne
milankarunarathne / image-study-fetch.js
Last active August 29, 2015 14:23 — forked from anonymous/gist:2d284ee3395f00a592f8
In a Diagnostic Report, fetch `imageStudy` data from third party application and display them.
angular.module('radiologyApp',[])
.controller('radiologyController',function($scope,$http,$window){
$http({method:'GET',
headers: {'Accept': 'application/json'},
url: 'http://fhir.hackathon.siim.org/fhir/DiagnosticReport?subject=Patient/siimsally'
}).
success(function(data,status,headers,config){
$scope.patientstudies = data
$scope.count= data['totalResults']
@milankarunarathne
milankarunarathne / DiagnosticReport-example.json
Created June 17, 2015 19:08
FHIR Diagnostic Report Example JSONs
{
"resourceType": "DiagnosticReport",
"id": "101",
"text": {
"status": "generated",
"div": "<div>\n \n <h3>CBC Report for Wile. E. COYOTE (MRN: 23453) issued 3-Mar 2011 11:45</h3>\n\n \n <pre>\nTest Units Value Reference Range\nHaemoglobin g/L 176 135 - 180\nRed Cell Count x10*12/L 5.9 4.2 - 6.0\nHaematocrit 0.55+ 0.38 - 0.52\nMean Cell Volume fL 99+ 80 - 98\nMean Cell Haemoglobin pg 36+ 27 - 35\nPlatelet Count x10*9/L 444 150 - 450\nWhite Cell Count x10*9/L 4.6 4.0 - 11.0\nNeutrophils % 20\nNeutrophils x10*9/L 0.9--- 2.0 - 7.5\nLymphocytes % 20\nLymphocytes x10*9/L 0.9- 1.1 - 4.0\nMonocytes % 20\nMonocytes x10*9/L 0.9 0.2 - 1.0\nEosinophils % 20\nEosino
@milankarunarathne
milankarunarathne / Decoder.js
Last active August 29, 2015 14:19
Decode messages under a scheme
/******************************************************************************
* @author : Milan Karunarathne
* @email : mhkarunarathne@gmail.com
* @summary : Decode messages under a encoding scheme such as
* a sequence of "key" strings of 0's and 1's as follows:
* 0,00,01,10,000,001,010,011,100,101,110,0000,0001,...,
* 1011,1110,00000, ...
* The keys are mapped to the characters in a given header in order.
*****************************************************************************/
'use strict';