This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub mod flight_discount { | |
| pub trait Discount { | |
| fn percentage(self: Self) -> u8; | |
| } | |
| #[allow(dead_code)] | |
| pub enum SpanishSubsidy { | |
| LargeFamily, | |
| ResidentOfIslandsOrCeuta, | |
| SpecialResidentLargeFamily, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Readable, pipeline } from 'stream' | |
| import fs from 'fs' | |
| import path from 'path' | |
| import { EOL } from 'os' | |
| function createTransaction () { | |
| return { | |
| date: new Date(Math.random() * 100_000_000_000), | |
| type: Math.random() > 0.5 ? 'INCOME' : 'OUTCOME', | |
| amount: +(Math.random() * 100).toFixed(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function osReport(os) { | |
| const cpus = os.cpus() | |
| const totalMemory = os.totalmem() | |
| const freeMemory = os.freemem() | |
| const usedMemory = totalMemory - freeMemory | |
| return ` | |
| Arch: ${os.arch} | |
| CPUS: ${cpus.length} (${cpus[0].model} ${cpus[0].speed}) | |
| Memory: ${fromBytesToGigabytes(usedMemory)}/${fromBytesToGigabytes(totalMemory)} | |
| Platform: ${os.platform} |
OlderNewer