Skip to content

Instantly share code, notes, and snippets.

View dontpaniclabsgists's full-sized avatar

Don't Panic Labs dontpaniclabsgists

View GitHub Profile
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
let total = 100;
total -= 20; // total is now 80
let count = 0; count += 5;
// count is now 5
let message = 'Learning Assignment Statements';
const appName = 'Angular Adventures';
// message can change, but appName is constant.
interface User {
name: string;
age: number;
}
let user: User = { name: "Alice", age: 30 };
function displayUser(user: User): void {
console.log(user.name + " is " + user.age + " years old.");
}
let user = { name: "Alice", age: 30 };
function displayUser(user) {
console.log(user.name + " is " + user.age + " years old.");
}
displayUser(user); // Output: Alice is 30 years old.
function greet(name: string): string {
return "Hello, " + name;
}
console.log(greet("Alice")); // Output: Hello, Alice
console.log(greet(123)); // Error: Argument of type 'number' is not assignable to parameter of type 'string'.