This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Event } from './EvaluateExpression' | |
export async function handler(event: Event): Promise<any> { | |
// console.log('event', JSON.stringify(event)) | |
const { expression, isFunction, expressionAttributes } = event | |
const source = isFunction ? `return (${expression})($, $$)` : `return ${expression}` | |
return Function(...Object.keys(expressionAttributes), source)(...Object.values(expressionAttributes)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ScheduleTargetBase, ScheduleTargetBaseProps } from "@aws-cdk/aws-scheduler-targets-alpha" | |
import { IRole, Role } from "aws-cdk-lib/aws-iam" | |
import { EventBus } from "aws-cdk-lib/aws-events" | |
import { ISchedule, ScheduleTargetConfig, ScheduleTargetInput } from "@aws-cdk/aws-scheduler-alpha" | |
/** | |
* This is a simple implementation of a EventBridge Scheduler Target that will put events to an EventBus. | |
* It is built upon the base provided by @aws-cdk/aws-scheduler-targets-alpha. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* American Soundex algorithm (see https://en.wikipedia.org/wiki/Soundex) | |
* | |
* @example | |
* americanSoundex('Robert') === 'R163' | |
* americanSoundex('Rupert') === 'R163' | |
* americanSoundex('Rubin') === 'R150' | |
* americanSoundex('Ashcraft') === 'A261' | |
* americanSoundex('Ashcroft') === 'A261' | |
* americanSoundex('Tymczak') === 'T522' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const common = require('./cucumberjs_formatter_common.js') | |
const formatter = function (options) { | |
const cucumber = require(options.parsedArgvOptions.cucumberLibPath) | |
new cucumber.SummaryFormatter(options) | |
let currentUri = '' | |
let currentFeatureName = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This demonstrates how to use sheet(item:...) when the requirement is to pass a binding to the | |
// view presented by the sheet. Also relevant to fullCoverSheet(item:...) | |
// | |
// What we want the sheet to do is provide an editable form that can be cancelled, so partial changes | |
// are not committed to the ancestors view state. We only want the state changed IF the form is confirmed (save action) | |
// | |
import SwiftUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.createReadStream(argv.heart) | |
.pipe(csv.parse({ objectMode: true })) | |
.pipe(csv.transform({ | |
header: columns => { | |
const properties = { | |
Start: 'start', | |
End: 'end', | |
'Heart Rate (count/min)': 'heartRate', | |
} | |
return columns.map(column => properties[column] || column) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select STR_TO_DATE(CONCAT(H.date, ' ', H.time), '%d/%m/%Y %H:%i') as datetime, H.min, H.max, coalesce(S.steps,0) as steps from heartrate H | |
left join steps S on | |
(H.date = S.date or H.date is null and S.date is null) | |
and | |
(H.time = S.time or H.time is null and S.time is null) | |
order by H.date, H.time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
type KeyType = string | |
type ValueType = any | |
type MyMap = { | |
[KeyType]: ValueType | |
} | |
const object: MyMap = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
set foo(value) { | |
Object.defineProperty(this, '_foo', { | |
value: value, | |
enumerable: false | |
}) | |
} | |
get foo() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
type Predicate<T> = T => boolean | |
export default function cherryPick<T>(memo: Array<T>, predicate: Predicate<T>, subject: T): Array<T> { | |
if (predicate(subject)) { | |
return [ ...memo, subject ] | |
} | |
if (Array.isArray(subject)) { | |
return subject.reduce((memo, subject) => cherryPick(memo, predicate, subject), memo) |
NewerOlder