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
/* | |
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | |
* See LICENSE in the project root for license information. | |
*/ | |
html, | |
body { | |
width: 100%; | |
height: 100%; | |
margin: 0; |
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 Pool = require("ibm_db").Pool; | |
const ool = new Pool(); | |
const dsn = process.env.dsn; | |
const client = new Pool({ minPoolSize: 0, maxPoolSize: 0, connectionTimeout: 60 }); | |
client.init(0, dsn); | |
client.open(dsn, () => console.log('Opened')); | |
client.open(dsn, () => console.log('Opened')); |
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
node_modules |
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 { Plugins } from '@capacitor/core'; | |
const { Storage } = Plugins; | |
export class User { | |
name?: string; | |
given_name?: string; | |
family_name?: string; | |
middle_name?: string; | |
nickname?: string; | |
preferred_username?: string; |
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 handleResult = (query, result) => { | |
const exp = RegExp(`(?<token>${query})`, 'g'); | |
return result.replaceAll(exp, (_, match) => `<b>${match}</b>`); | |
} | |
console.log(handleResult('read', 'reading is fun') === '<b>read</b>ing is fun'); | |
console.log(handleResult('read', 'reading is reading') === '<b>read</b>ing is <b>read</b>ing'); | |
console.log(handleResult('s', 'ss is ss') === '<b>s</b><b>s</b> i<b>s</b> <b>s</b><b>s</b>'); |
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
#!/usr/bin/env node | |
// The #!/usr/bin/env node is important so that our lambda function | |
// knows we are trying to run our extension using nodejs. | |
const { EventTypes, ...extensionAPIService} = require('./api/extensions')(); | |
const logger = require('./util/logger'); | |
// We use a self invoking function so that our extension code will boot up on lambda start | |
(async function main () { | |
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
while(true) { | |
/** | |
* When our function resumes we get the response from the .next function and continue. | |
* | |
* Once we finish our work and we go back to the top of the while loop we will make | |
* the call to .next and our code immediately freezes. | |
*/ | |
const event = await extensionAPIService.next({ | |
extensionIdentifier | |
}); |
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 http = require('http'); | |
const ExtensionAPIService = () => { | |
const baseUrl = `http://${process.env.AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension`; | |
const keepAliveAgent = new http.Agent({ keepAlive: true }); | |
let extensionId; | |
const EventTypes = { | |
Invoke: 'INVOKE', | |
Shutdown: 'SHUTDOWN', | |
}; |
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
#!/usr/bin/env node | |
// The #!/usr/bin/env node is important so that our lambda function | |
// knows we are trying to run our extension using nodejs. | |
const { EventTypes, ...extensionAPIService} = require('./api/extensions')(); | |
const TelemetryAPIService = require('./api/telemetry'); | |
const logger = require('./util/logger'); | |
// We use a self invoking function so that our extension code will boot up on lambda start | |
(async function main () { |
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
while(true) { | |
/** | |
* When our function resumes we get the response from the .next function and continue. | |
* | |
* Once we finish our work and we go back to the top of the while loop we will make | |
* the call to .next and our code immediately freezes. | |
*/ | |
logger.log('Extension calling next: ', extensionIdentifier); | |
const event = await extensionAPIService.next({ | |
extensionIdentifier |
OlderNewer