Skip to content

Instantly share code, notes, and snippets.

View psygo's full-sized avatar
๐ŸŽฏ
focusing

Philippe Fanaro psygo

๐ŸŽฏ
focusing
View GitHub Profile
@psygo
psygo / mixins_vs_extensions.md
Created October 19, 2020 01:50
Mixins vs Extensions in Dart

Mixins vs Extensions in Dart

The Major Differences

  • Mixins allow for an adapted multiple inheritance.
    • Though they have the limitation that you cannot have mixins inheriting mixins.
  • Extensions let you add new methods to a class but not state (new instance variables).
    • But you can use stuff like the [Expando object][expando].
    • They can't override methods either.
@psygo
psygo / codecov_pure_dart.md
Last active October 8, 2020 00:00
Code Coverage with Pure Dart

Gathering Code Coverage

  1. Install the coverage package:
    pub global activate coverage
  2. Create a test file for running all of the tests.
  3. Run โ€” in this case, the file with all of the tests is called .test_coverage.dart โ€”:
    dart --pause-isolates-on-exit --disable-service-auth-codes --enable-vm-service=NNNN test/.test_coverage.dart
@psygo
psygo / linux_heroic_commands.md
Created September 16, 2020 18:12
Linux Heroic Commands

Linux Heroic Commands

From a tutorial somewhere...

  1. sudo !! : re-executing the last command as sudo.
  2. Ctrl + X + E in the terminal to open an editor.
  3. Create a super fast RAM disk (hard drive on the RAM):
    mkdir -p /mnt/ram

mount -t tmpfs /mnt/ram -o size=8192M

@psygo
psygo / joker_baduk.md
Created September 13, 2020 00:15
Joker Baduk

Joker Baduk

  1. ์ƒ๋Œ€๋ฐฉ์˜ ๋Œ๋กœ 2์ˆ˜ ๋‘์„ธ์š” play two moves with your opponent stones..... Illegal moves are not allowed
  2. ์•ผํ˜ธ! Play two moves wherever you want
  3. ๊ฝ pass
  4. ๊ฐ€์œ„,๋ฐ”์œ„,๋ณด๋ฅผ winner can change the opponent's stone to his buke....the one who has more buke shapes, gets two captured stone.
  5. 1์„ ์— 3์ˆ˜๋ฅผ play 3 moves on the first line
  6. ๊ณต์งœ ํ•œ์ˆ˜ play one move and get another card
  7. ์ƒ๋Œ€์—๊ฒŒ ๋‚ด ์ด๋ฆ„์„ ๋ฌผ์–ด๋ณด์„ธ์š” ask your opponent: what is my name? If he knows u give 2 points
  8. ํ‚ค๊ฐ€ ํฐ ์‚ฌ๋žŒ์ด ์ž‘์€์‚ฌ๋žŒ์—๊ฒŒ taller gives 2points to the smaller one
@psygo
psygo / reflection_and_annotations.md
Last active November 29, 2024 21:16
Reflection and Annotations in Dart

Reflection in Dart

Unfortunately, [since mirrors currently bloat compiled code][no_support_mirrors], it isn't supported for Flutter or web apps. A [workaround][source_gen_tutorial] would be to use a package like [source_gen][source_gen].

dart:mirrors

Most of the info here, comes from [Understanding Reflection and Annotations in Dart tutorial][reflection_tutorial], from the Fullstack Dart and Flutter Tutorials YouTube channel. He also created a [gist][gist_tutorial] with it.

@psygo
psygo / different_fixed_list_initializations.dart
Last active September 9, 2020 14:11
Different Fixed List Initializations
/// To run this, you can simply use:
///
/// ```sh
/// dart different_fixed_list_initializations.dart
/// ```
/// For more, check out the [`List` docs][list_docs].
///
/// The `UnmodifiableListMixin` and `FixedLengthListMixin` are actually
/// abstract classes, not mixins. They are both inside
@psygo
psygo / immutability_resources.md
Last active September 6, 2020 21:24
Resources for Studying Immutability in the Context of OOP Languages

Immutability Resources for Dart

Resources for studying immutability in the context of OOP languages.

The numbering below is simply for differentiation.

~90% of the resources below come from Marcelo Glasberg.

0. How do I read this???

@psygo
psygo / hotkey.ahk
Created August 8, 2020 21:31
AutoHotKey Simple Example
#j::
Send, nuclear launch codes
return
@psygo
psygo / factorial.dart
Last active August 8, 2020 21:16
The Most Succinct Form Factorial Function
/// Using `n == 1` won't work usually because the `n` input can be `0`.
int factorial(int n) => n == 0 ? 1 : n * factorial(n - 1);
@psygo
psygo / settings.json
Last active June 2, 2020 17:45
Example of Customizing Syntax for a Theme in VS Code
{
"editor.tokenColorCustomizations": {
"[One Dark Pro]": {
"types": "#7BC374"
}
}
}