TypeScript as main language.
Tsx to execute TypeScript code in Node.js.
Parcel for bundling.
React with Mantine for Single Page Applications.
Create PubSub for event-driven apps.
const fs = require("fs"); | |
const https = require("https"); | |
const express = require("express"); | |
const forge = require("node-forge"); | |
function generateCert(options) { | |
const keys = forge.pki.rsa.generateKeyPair(2048); | |
const cert = forge.pki.createCertificate(); | |
cert.publicKey = keys.publicKey; | |
cert.serialNumber = "01"; |
import { isOdd } from "./isOdd.mjs"; | |
isOdd(7); // returns true | |
isOdd(8); // returns false | |
isOdd(9); // returns true |
const accessToken = 'YOUR_LINKEDIN_ACCESS_TOKEN'; | |
async function getLinkedinArticles() { | |
const response = await fetch( | |
`https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,articles)`, | |
{ | |
headers: { | |
'Authorization': `Bearer ${accessToken}`, | |
'cache-control': 'no-cache', | |
}, |
/** @see https://docs.github.com/en/rest/users/followers?apiVersion=2022-11-28#follow-a-user */ | |
(async () => { | |
// Generate a fine-grained token with the following "Followers" scope (read/write) at https://github.com/settings/tokens | |
const token = "YOUR_GITHUB_TOKEN"; | |
const usernames = ["XXX", "YYY", "ZZZ"]; | |
const headers = { | |
Accept: "application/vnd.github+json", | |
Authorization: `Bearer ${token}`, |
import fetch from "node-fetch"; | |
import restana from "restana"; | |
const service = restana(); | |
const pageSize = process.env.PAGE_SIZE ? parseInt(process.env.PAGE_SIZE) : 5; | |
const port = process.env.PORT ? parseInt(process.env.PORT) : 3000; | |
const topStoriesResponse = await fetch( |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>PeerJS</title> | |
</head> | |
<body> | |
<script src="https://unpkg.com/[email protected]/dist/peerjs.min.js"></script> |
declare module "js13k-2d" { | |
declare interface Point { | |
x: number; | |
y: number; | |
set(xy: number): void; | |
set(x: number, y: number): void; | |
} | |
declare interface Sprite { | |
position: Point; | |
alpha: number; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/webextensions/console-panel/src/console-panel.css" /> | |
<script src="https://cdn.jsdelivr.net/gh/webextensions/console-panel/src/console-panel.js"></script> | |
<script> | |
window.consolePanel.enable(); |
import { defineConfig } from "vite"; | |
import { minifyHtml } from "vite-plugin-html"; | |
import { viteSingleFile } from "vite-plugin-singlefile"; | |
import { Packer, InputType, InputAction } from "roadroller"; | |
export default defineConfig({ | |
plugins: [ | |
{ | |
name: "roadroller", | |
async transformIndexHtml(html, context) { |
TypeScript as main language.
Tsx to execute TypeScript code in Node.js.
Parcel for bundling.
React with Mantine for Single Page Applications.
Create PubSub for event-driven apps.