Railscast Next
Publisher: Eduardo Hidalgo HThemes in package: 1
Full workbench mockup using this variant's colors and tokenColors.
Loading...
TextMate scopes and font styles (syntax highlighting rules).
| scope | foreground | fontStyle |
|---|---|---|
| — | #E6E1DC | — |
| source | — | — |
| comment, punctuation.definition.comment | #BC9458 | italic |
| entity.name.function, keyword.other.name-of-parameter.objc | #FFC66D | |
| entity.name | #FFFFFF | — |
| constant.numeric | #A5C261 | |
| variable.language, variable.other | #D0D0FF | |
| constant, variable.other.constant.js | #6D9CBE | |
| variable.other.constant | #DA4939 | — |
| constant.language | #6E9CBE | |
| string | #EBD699 | |
| support.function | #DD5B4D | |
| support.type, support.variable, support.class | #6E9CBE | — |
| support.constant | #6E9CBE | — |
| meta.tag - meta.tag.script - meta.tag.style - meta.tag.inline, declaration.tag, entity.name.tag, entity.other.attribute-name | #629F9E | |
| untitled | — | — |
| invalid | #FFFFFF | — |
| constant.character.escaped, constant.character.escape, string source, string source.ruby | #519F50 | |
| markup.inserted | #E6E1DC | — |
| markup.deleted | #E6E1DC | — |
| meta.diff.header, meta.separator.diff, meta.diff.index, meta.diff.range | — | — |
| entity.other.attribute-name.html | #93C08A | — |
| entity.name.tag.inline.any.html | #629F9E | — |
| source.css.embedded.html string.quoted.double.html, meta.tag.inline.any.html string.quoted.double.html, meta.tag.any.html string.quoted.double.html, source.js.embedded.html string.quoted.double.html | #BFC08A | — |
| punctuation.definition.tag, punctuation.definition.tag.begin, punctuation.definition.tag.end | #66B385 | — |
| constant.other.color.rgb-value.css | #C6E0CA | — |
| entity.other.attribute-name.class.css | #FFD24A | — |
| entity.other.attribute-name.id.css | #FF9C4A | — |
| entity.name.tag.css, keyword.control.html.elements | #D7A100 | — |
| meta.property-value.css, support.constant.font-name.css | #A5C260 | — |
| support.type.property-name.css | #8AA6C2 | — |
| constant.numeric.css | #EFD77D | — |
| keyword.other.unit.css | #748CA3 | — |
| punctuation.separator.key-value.css, punctuation.terminator.rule.css | #E6E1DC | — |
| punctuation.section.embedded.end.php, punctuation.section.embedded.begin.php | #FF8064 | bold |
| variable.other.property.php | #E6E1DC | — |
| support.constant.std.php | #6D9CBE | italic |
| support.class.php | — | italic |
| storage.type.function.php | — | bold |
| source.php meta.function-call, entity.name.function.js | #F9D8D2 | — |
| variable.parameter.function.js | #519F50 | |
| keyword.control.import.include.php, support.function.construct.php, storage.type.php, constant.other.object.key.js string.unquoted.label.js, meta.function.json.js entity.name.function.js, meta.object-literal.key.js, support.type.property-name.json | #F09772 | — |
| keyword.operator.js, punctuation.separator.key-value.js | #A1C2A8 | — |
| keyword, storage, keyword.operator.expression, keyword.operator.new | #A1C2A8 |
export interface User {
id: string;
name: string;
role: "admin" | "member";
tags: string[];
}
/**
* Fetch user data by ID
* @param id
* @returns User object or null if ID is invalid
*/
export async function fetchUser(id: string): Promise<User | null> {
if (!id) {
return null;
}
const response = await fetch(`/api/users/${id}`, {
method: "GET",
headers: { Accept: "application/json" },
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return (await response.json()) as User;
}
function greet(user: User): string {
// Simple greeting function that uses the user's name
return `Hello, ${user.name}!`;
}