🏳️⚧️
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
/** | |
* The validation scheme for an option that is an object. | |
* @since 0.11.0 | |
*/ | |
export type KipperConfigObjectValidatorScheme = { | |
[key: string]: "string" | "boolean" | "array<string>" | KipperConfigObjectValidatorScheme; | |
} | |
/** | |
* The validation scheme for the Kipper config. |
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
def isPrime(n: num) -> bool { | |
if (n <= 1) { | |
return false; // Never a prime | |
} else if (n == 2 || n == 3) { | |
return true; // Base primes | |
} else if (n % 2 == 0 || n % 3 == 0) { | |
return false; // Easy base prime checks | |
} | |
for (var i: num = 5; i * i <= n; i += 6) { |
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
def primeFactors(n: num) -> void { | |
while (n % 2 == 0) { | |
print("2"); | |
n /= 2; | |
} | |
// For all non-even divisors | |
for (var i: num = 3; i * i <= n; i += 2) { | |
while (n % i == 0) { | |
print(f"{i}"); |
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
def pow(base: num, powerTo: num) -> num { | |
return base ** powerTo; | |
} | |
var result: num = pow(2, 8); // -> 256 | |
print(result as str); |
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
def add(firstNum: num, secondNum: num) -> num { | |
return firstNum + secondNum; | |
} | |
var result: num = add(1, 2); | |
print(result as str); |
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
# Jisho.org Support for Anki | |
import os, re, json, requests, urllib.request, urllib.parse | |
from aqt import gui_hooks | |
from aqt import mw | |
from aqt.qt import qconnect | |
from aqt.editor import Editor | |
from aqt.utils import showInfo | |
from anki.utils import stripHTML |
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
var x: num = 5; | |
def incr(val: num) -> void { x += val; } | |
def prn(val: num) -> void { print(val as str); } | |
/* Increment and print */ | |
incr(5); | |
prn(x); | |
/* Increment and print */ |
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
/** | |
* Sample Script for showing the core functionality of how runtime types should work in Kipper. | |
*/ | |
"use strict"; | |
// @ts-ignore | |
var __kipperGlobalScope = typeof __kipperGlobalScope !== "undefined" ? __kipperGlobalScope : typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; | |
// @ts-ignore | |
var __kipper = __kipperGlobalScope.__kipper = __kipperGlobalScope.__kipper || __kipper || {}; | |
// The parent of all Kipper runtime types |
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 * as dot from 'dot'; | |
import * as fs from "fs"; | |
import * as rimraf from 'rimraf'; | |
const source: string = `${__dirname }/templates`; | |
const destination: string = `${__dirname}/dot-build`; | |
// Generate destination files from source template files | |
(async () => { | |
// If the destination folder exists, remove it to ensure it does not contain old files |
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
// -------------------------------- | |
// file1.ts | |
// -------------------------------- | |
// Kipper Built-ins | |
function __print__(msg: string): void { console.log(msg); } | |
// Import other Kipper modules | |
import * as __file2__ from "./file2"; |
NewerOlder