Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
// Liskov substitution principle | |
void main() { | |
PayPalProcessor payPalProcessor = PayPalProcessor(); | |
VisaPaymentProcessor visaProcessor = VisaPaymentProcessor(); | |
// Here the checkout function don't now which service it is using to process the payment. | |
// THe underlying implementation is hidden from the checkout function. | |
// | |
// I can add more function to the payment processor and can extend it's functionality. | |
checkout(payPalProcessor, 230); |
# Dart-SRP | |
void main() { | |
ApiController apiRedisService = ApiController(cacheService: RedisService()); | |
ApiController apiNodeCacheService = ApiController(cacheService: NodeCacheService()); | |
apiRedisService.saveToCache('Hello'); | |
apiNodeCacheService.saveToCache('Main'); | |
} |
import 'dart:io' show Directory, FileSystemEntity, Platform; | |
import 'package:path/path.dart' as path_lib; | |
/// Static helper class for determining platform's app data path. | |
/// | |
/// Does not require [AppData] to work, can be standalone. | |
/// Paths for MacOS and Linux were choosen based on popular | |
/// StackOverflow answers. Submit a PR if you believe these are | |
/// wrong. | |
class Locator { |
Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.
NOTE: This logic can be extended to more than two accounts also. :)
The setup can be done in 5 easy steps:
'use strict'; | |
const DEF_CURRENCY = 'USD'; | |
const DEF_SCALE_FACTOR = 100; | |
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
const ObjectId = Schema.ObjectId; | |
const MoneySchema = new Schema({ |
import 'dart:convert'; | |
void main() { | |
String object = '{"name": "hello"}'; | |
print(User.createInstance(jsonDecode(object)).name); | |
String name = null; | |
print(name); | |
} | |