Steemit Hints & Tips - Code sample commentssteemCreated with Sketch.

in steemit •  7 years ago  (edited)

This post is part of the Steemit Hints & Tips Serie!

Let me know in the comments if you have have nice ideas to share!

hr

Code sample comments

When we explain a piece of code in a post, we like to highlight the specific code lines with numbers / letters:

import { Injectable } from '@angular/core';

@Injectable()
export class RandomService {

    constructor() {}

    getRandomNumber(): number {
        return 4; // 🅰
    }

    getReferenceUrl(): string {
        return "https://xkcd.com/221/"; // 🅱
    }

}

🅰 Chosen by fair dice roll. Guaranteed to be random.
🅱 Inspiration for this brilliant algorithm, by xkcd.

You may choose among many different styles of letters and numbers.

① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩
➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉
❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾ ❿
➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓
⓵ ⓶ ⓷ ⓸ ⓹ ⓺ ⓻ ⓼ ⓽ ⓾
Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ
ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ
🅐 🅑 🅒 🅓 🅔 🅕 🅖 🅗 🅘 🅙
🄰 🄱 🄲 🄳 🄴 🄵 🄶 🄷 🄸 🄹
🅰 🅱 🅲 🅳 🅴 🅵 🅶 🅷 🅸 🅹
ⅰ ⅱ ⅲ ⅳ ⅴ ⅵ ⅶ ⅷ ⅸ ⅹ
𝝰𝝱𝝲𝝳𝝴𝝵𝝶𝝷𝝸𝝹
★■●🟊◆▮🟌
♚♛♜♝♞♟
♠ ♣ ♥ ♦

Remarks:

  • We prefer 🅐 over Ⓐ as they are more visible.

  • ⚠ Always have the unicode characters inside comments to allow copy pasting your code. Here, in Typescript, we use "//".

hr

Have a look at our Series:

Stay tuned! We're just getting started!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!