ref: move notebooks to own directory

This commit is contained in:
Anton Nesterov 2024-09-29 14:14:44 +02:00
parent cc0dcd0bf4
commit f8cde668cd
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5
16 changed files with 104 additions and 97 deletions

3
.gitignore vendored
View file

@ -1 +1,2 @@
.DS_Store
.DS_Store
node_modules

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# @nesterow/shortcuts
Various functions for JS, Go and Jupyter Notebooks.

BIN
bun.lockb Executable file

Binary file not shown.

View file

@ -1,8 +1,6 @@
{
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"@std/assert": "jsr:@std/assert@1"
}
}

View file

@ -1,79 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Estimated offset is: 0.982618\n",
"Estimated slope is: 3.000173\n",
"R^2: 0.999999\n",
"2 <object> <object>\n"
]
},
{
"data": {
"text/plain": [
"\u001b[1mnull\u001b[22m"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import stats from \"./stat/mod.ts\";\n",
"\n",
"stats.example();"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2 \u0001\u0002\u0003\n"
]
},
{
"data": {
"text/plain": [
"\u001b[1mnull\u001b[22m"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Deno",
"language": "typescript",
"name": "deno"
},
"language_info": {
"codemirror_mode": "typescript",
"file_extension": ".ts",
"mimetype": "text/x.typescript",
"name": "typescript",
"nbconvert_exporter": "script",
"pygments_lexer": "typescript",
"version": "5.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,8 +0,0 @@
export function add(a: number, b: number): number {
return a + b;
}
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
if (import.meta.main) {
console.log("Add 2 + 3 =", add(2, 3));
}

View file

@ -1,6 +0,0 @@
import { assertEquals } from "@std/assert";
import { add } from "./main.ts";
Deno.test(function addTest() {
assertEquals(add(2, 3), 5);
});

1
mod.ts Normal file
View file

@ -0,0 +1 @@
console.log("Hello via Bun!");

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [
{

View file

@ -0,0 +1,59 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Linear Regression Line:\n",
"\tEstimated offset is: 1.480586\n",
"\tEstimated slope is: 2.999774\n",
"\tR^2 is: 0.999991\n"
]
}
],
"source": [
"import stats from \"https://l12.xyz/x/shortcuts/raw/stat/mod.ts\";\n",
"\n",
"const xs = [];\n",
"const ys = [];\n",
"\n",
"for (let i = 0; i < 100; i++) {\n",
" xs.push(i);\n",
" ys.push((1 + 3 * i) + Math.random());\n",
"}\n",
"\n",
"const linreg = stats.LinearRegression(xs, ys, [], false);\n",
"const r = stats.RSquared(xs, ys, [], linreg.alpha, linreg.beta);\n",
"\n",
"console.log(\"\\nLinear Regression Line:\");\n",
"console.log(\"\\tEstimated offset is: \", linreg.alpha.toFixed(6));\n",
"console.log(\"\\tEstimated slope is: \", linreg.beta.toFixed(6));\n",
"console.log(\"\\tR^2 is: \", r.toFixed(6));\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Deno",
"language": "typescript",
"name": "deno"
},
"language_info": {
"codemirror_mode": "typescript",
"file_extension": ".ts",
"mimetype": "text/x.typescript",
"name": "typescript",
"nbconvert_exporter": "script",
"pygments_lexer": "typescript",
"version": "5.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

11
package.json Normal file
View file

@ -0,0 +1,11 @@
{
"name": "@nesterow/shortcuts",
"module": "mod.ts",
"type": "module",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}

27
tsconfig.json Normal file
View file

@ -0,0 +1,27 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}