Skip to content

Instantly share code, notes, and snippets.

rm CognitiveModels/FlightBooking.cs
rm CognitiveModels/FlightBooking.json
rm CognitiveModels/FlightBookingEx.cs
rm Dialogs/BookingDialog.cs
rm Dialogs/MainDialog.cs
rm BookingDetails.cs
rm FlightBookingRecognizer.cs
const cat = new FormGroup<{
name: FormControl<string>,
lives: FormControl<number>,
}>(...);
// extract from @dylhunn PR #43834 https://github.com/angular/angular/pull/43834
/**
* Tokenize splits a string literal S by a delimeter D.
*/
type Tokenize<S extends string, D extends string> = /*\n*/
string extends S ? string[] : /* S must be a literal */ /*\n*/
S extends `${infer T}${D}${infer U}` ? [T, ...Tokenize<U, D>] : /* Recursive case */ /*\n*/
[S] /* Base case */ /*\n*/
;
export function bindingUpdated(lView: LView, bindingIndex: number, value: any): boolean {
ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
ngDevMode &&
assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
const oldValue = lView[bindingIndex];
if (Object.is(oldValue, value)) {
return false;
} else {
if (ngDevMode && getCheckNoChangesMode()) {
http {
.....
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name qldcoviddata.com;
location / {
proxy_pass /app/qldcoviddata/dist;
}
IsConnected()
{
const duration = moment.duration(moment(new Date()).diff(moment(this.lastConnectedTime, this.DATE_TIME_FORMAT)));
return duration.asSeconds() < 60;
}
private async addNewUserSession(userName: string, allUserSessions: UserSession[]){
const allSessions = [...allUserSessions??[], new UserSession(userName)];
await this.cacheManager.set(
this.key,
allSessions,
{ ttl: this.expired_time },
);
}
import { Injectable } from '@angular/core';
import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
import { Socket } from 'ngx-socket-io';
@Injectable({
providedIn: 'root'
})
export class WebSocketService {
@SubscribeMessage('patientJoin')
public async joinRoom(client: Socket, userName: string) {
client.join('waitingRoom');
this.userSessionCache.addOrUpdate(userName);
const activeUsers = await this.userSessionCache.getAllActive();
this.server.emit('patientList', activeUsers.map(x=> x.userName));
}
@sunnyy02
sunnyy02 / infer.ts
Last active December 30, 2021 07:34
if (ts.isTypeReferenceNode(node)) {
const type = typeChecker.getTypeFromTypeNode(node);
const typeName = typeChecker.typeToString(type);
if (type.isStringLiteral()) {
ts.addSyntheticTrailingComment(
node,
ts.SyntaxKind.SingleLineCommentTrivia,
typeName
);
}