Skip to content

Instantly share code, notes, and snippets.

View dontpaniclabsgists's full-sized avatar

Don't Panic Labs dontpaniclabsgists

View GitHub Profile
let total = 100;
total -= 20; // total is now 80
let price = 50;
price *= 2; // price is now 100
let score = 40;
score /= 2; // score is now 20
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),
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
StringBuilder query = new StringBuilder($";select * from [DBName].[Businesses] ");
var models = db.Businesses.FromSqlRaw(query.ToString()).ToArray();
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 ");
<div class="header"> This is a header. </div>
class NotificationSender {
message: string;
recipient: string;
send(): void {
console.log(`Sending message: '${this.message}' to ${this.recipient}`);
}
}
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}`);