Skip to content

Instantly share code, notes, and snippets.

View dontpaniclabsgists's full-sized avatar

Don't Panic Labs dontpaniclabsgists

View GitHub Profile
let sports: string[] = ['Volleyball', 'Football', 'Basketball', 'Soccer'];
let notification: NotificationSender;
notification = new EmailSender("Project Update", "[email protected]");
notification.send(); // Output: Sending email: 'Project Update' to [email protected]
notification = new SMSSender("Meeting at 3 PM", "123456789");
notification.send(); // Output: Sending SMS: 'Meeting at 3 PM' to 123456789
class SMSSender extends NotificationSender {
send(): void {
console.log(`Sending SMS: '${this.message}' to ${this.recipient}`);
}
}
class EmailSender extends NotificationSender {
send(): void {
console.log(`Sending email: '${this.message}' to ${this.recipient}`);
}
class EmailSender extends NotificationSender {
sendEmail(): void {
console.log(`Sending email: '${this.message}' to ${this.recipient}`);
}
}
let emailNotification = new NotificationSender("Meeting Reminder", "[email protected]");
emailNotification.send(); // Output: Sending message: 'Meeting Reminder' to [email protected]
class NotificationSender {
message: string;
recipient: string;
constructor(message: string, recipient: string) {
this.message = message;
this.recipient = recipient;
}
send(): void {
console.log(`Sending message: '${this.message}' to ${this.recipient}`);
class NotificationSender {
message: string;
recipient: string;
send(): void {
console.log(`Sending message: '${this.message}' to ${this.recipient}`);
}
}
<div class="header"> This is a header. </div>
StringBuilder query = new StringBuilder($";With fullTable as (select b.[Id],[BusinessName], ");
// manipulate data
query.Append($"CAST(CASE WHEN COUNT(service.BusinessId)>0 THEN 1 ELSE 0 END AS bit) as servicesFlag")
query.Append($" from [DB].[Businesses] b ");
// add data to table that is needed for line 2 to execute properly
query.Append($"LEFT JOIN [DB].Services service ON service.BusinessId = b.Id ");
StringBuilder query = new StringBuilder($";select * from [DBName].[Businesses] ");
var models = db.Businesses.FromSqlRaw(query.ToString()).ToArray();