Skip to content

Instantly share code, notes, and snippets.

View matthewdenobrega's full-sized avatar

Matthew de Nobrega matthewdenobrega

View GitHub Profile
const conversionValueKey: string = 'http://my.lobsterink.com/xapi/extension/conversion-value'
const verbFirstOccurenceKey: string = 'http://my.lobsterink.com/xapi/extension/verb-first-occurence'
export class UserWithConversionValue {
conversionValue: number
userSubject: string
}
export class UserWithConversions {
conversions: Statement[]
let subjectAssessmentMapping: any = {
1: 3,
2: 99
}
export class MedalsSummary {
bronzeMedals: number
customMedals: number
goldMedals: number
silverMedals: number
let enrichedEventMatrix: EnrichedEventMatrix // Needs to be populated
function enrichUserEvent(eventInfo: EventInfo, enrichedEventMatrix: EnrichedEventMatrix): void {
let enrichedEventType: EnrichedEventType = enrichedEventMatrix[eventInfo.type]
if (!enrichedEventType) { return }
let dataFromApi: any = api.runQuery(enrichedEventType.enrichGraphQLQuery) // Need to parameterise this
let enrichedEvent: enrichedEvent = enrichedEventType.enrichMappingFunction(dataFromApi)
@matthewdenobrega
matthewdenobrega / gist:9531b9d563f3984a7e7d9d62a2724b9d
Last active June 14, 2017 05:57
Sketches for Hallmark content
/*
** Get published content
*/
getPublishedAssessmentByAssessmentId(assessmentId: number, hallmark: boolean): PublishedAssessment {
let query: string = “SELECT TOP 1 * FROM a IN PublishedCourse.assessments WHERE a.assessment_Id = @assessmentId ORDER BY a.dateCreated"
return db[hallmark ? 'hallmark' : 'client'].query(query)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matthewdenobrega
matthewdenobrega / graphQLUtils.ts
Last active November 9, 2017 08:23
GraphQL query generator
// Angular imports
import { isArray, isBlank, isDate, isNumber, isStringMap, isPresent, isString } from 'angular2/src/facade/lang'
export class GraphQLUtils {
static createMutation(data: Object, dataDefinition: Object, method: string, mutationName?: string): string {
if (!method || !data) { return null }
let mutation: string = (mutationName || method) + '{' + method
mutation += '(' + GraphQLUtils.flattenObject(data) + ')'
@matthewdenobrega
matthewdenobrega / gist:3042444445dd66fa9679
Created January 4, 2016 11:15
Catch handler to force unit tests to fail on exception
import {ComponentFixture, describe, expect, inject, it, TestComponentBuilder} from 'angular2/testing'
import {Component, View} from 'angular2/src/core/metadata'
@Component({ selector: 'basic-component' })
@View({ template: '<div></div>' })
class BasicComponent { }
// Set up the browser adapter
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter'
BrowserDomAdapter.makeCurrent()
@matthewdenobrega
matthewdenobrega / gist:35d6abd5011f348f04e0
Created January 4, 2016 10:47
Unit tests fail silently on exception in tcb.createAsync.then function
import {ComponentFixture, describe, expect, inject, it, TestComponentBuilder} from 'angular2/testing'
import {Component, View} from 'angular2/src/core/metadata'
@Component({ selector: 'basic-component' })
@View({ template: '<div></div>' })
class BasicComponent { }
// Set up the browser adapter
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter'
BrowserDomAdapter.makeCurrent()