Skip to content

Instantly share code, notes, and snippets.

Avatar
Busy

Joshua Kelly jdjkelly

Busy
View GitHub Profile
View fhir.ts
/**
* @module client
* @remarks Almost no-dependency TS FHIR client (we use cross fetch to give us a fetch instance)
*/
import fetch from "cross-fetch";
type Summary = "true" | "false" | "text" | "count" | "data";
export default function(baseUrl: string, init: RequestInit) {
View Store
import Resource from "../resources"
export type Status = 'create' | 'updated' | 'deleted' | 'recreated';
type IStore = {
[key in Resource]: {
id: {
id: string;
txid: number;
ts: number;
View gist:ee65583cf6b4950967faa030ad10a257
Verifying my Blockstack ID is secured with the address 1BYTD7LegnE7BuvwMfr13yT2hXQfbp9NAc https://explorer.blockstack.org/address/1BYTD7LegnE7BuvwMfr13yT2hXQfbp9NAc
@jdjkelly
jdjkelly / message.rs
Created Oct 22, 2017
Parity's Envelope Struct
View message.rs
pub struct Envelope {
/// Expiry timestamp
pub expiry: u64,
/// Time-to-live in seconds
pub ttl: u64,
/// series of 4-byte topics.
pub topics: SmallVec<[Topic; 4]>,
/// The message contained within.
pub data: Vec<u8>,
/// Arbitrary value used to target lower PoW hash.
View schema.flow.js
/* @flow */
// interfaces/schema.flow.js
// This file was automatically generated and should not be edited.
export type DemoQueryQueryVariables = {|
id: string,
|};
export type DemoQueryQuery = {|
order: ? {|
View demo-query.graphql
# src/routes/demo/queries/demo-query.graphql
query DemoQuery($id: ID!) {
order(id: $id) {
id
buyer {
id
name
}
}
}
View lookup.js
// A collection Orders contains the following documents:
{ "_id" : 1, "item" : "abc", "price" : 12, "quantity" : 2 }
{ "_id" : 2, "item" : "jkl", "price" : 20, "quantity" : 1 }
{ "_id" : 3 }
// Another collection Inventory contains the following documents:
{ "_id" : 1, "sku" : "abc", description: "product 1", "instock" : 120 }
{ "_id" : 2, "sku" : "def", description: "product 2", "instock" : 80 }
{ "_id" : 3, "sku" : "ijk", description: "product 3", "instock" : 60 }
{ "_id" : 4, "sku" : "jkl", description: "product 4", "instock" : 70 }
View match2.js
db.articles.aggregate(
[{ $match: {
$or: [{
score: { $gt: 90 }
}, {
author: "dave"
}}]
}}]
);
View match.js
// Given these documents in a collection
{ "_id" : ObjectId("512bc95fe835e68f199c8686"), "author" : "dave", "score" : 80 }
{ "_id" : ObjectId("512bc962e835e68f199c8687"), "author" : "dave", "score" : 85 }
{ "_id" : ObjectId("55f5a192d4bede9ac365b257"), "author" : "ahn", "score" : 60 }
{ "_id" : ObjectId("55f5a192d4bede9ac365b258"), "author" : "li", "score" : 55 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b259"), "author" : "annT", "score" : 60 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b25a"), "author" : "li", "score" : 94 }
{ "_id" : ObjectId("55f5a1d3d4bede9ac365b25b"), "author" : "ty", "score" : 95 }
// Apply this aggregation