Skip to content

Instantly share code, notes, and snippets.

View dontpaniclabsgists's full-sized avatar

Don't Panic Labs dontpaniclabsgists

View GitHub Profile
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();
stateVariations = db.StateVariations.ToArray();
// do any filtering on items other than state here, before pulling into memory
translations = db.Translations.Filter(…).ToArray();
joinedData = translations.GroupJoin(
stateVariations,
translation => translation.Id,
variation => variation.SystemLanguageTranslationId,
(translation, variation) => new { translation, variations = variation })
.Select(x => new CombinedDataObject
Db.Translations.GroupJoin(
db.StateVariations,
translation => translation.Id,
variation => variation.TranslationId,
(translation, variation) => new { translation, variations = variation })
.Select(x => new CombinedDataObject
{
Id = x.translation.Id,
EN = x.translation.EN,
Variations = Mapper(x.variations),
let score = 40;
score /= 2; // score is now 20
let price = 50;
price *= 2; // price is now 100