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
| // Adapter pattern example for integrating different payment gateways | |
| class PayPal { | |
| makePayment(amount) { | |
| console.log(`Paying ${amount} via PayPal`); | |
| } | |
| } | |
| class Stripe { | |
| pay(amount) { | |
| console.log(`Paying ${amount} via Stripe`); |
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 { Database } from "bun:sqlite"; | |
| const db = new Database("logs.sqlite", { strict: true }); | |
| await db.run( | |
| `CREATE TABLE IF NOT EXISTS logs ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| data TEXT NOT NULL, | |
| timestamp DATETIME DEFAULT CURRENT_TIMESTAMP | |
| )`, |
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
| {"label":"X-commit Tokens","message":"1246","schemaVersion":1,"color":"hsl(70, 100%, 40%)"} |
OlderNewer