initial vitepress site with basic nav

This commit is contained in:
mrflos 2023-05-20 19:37:42 +03:00
parent a7df2e049d
commit 2029f16583
1900 changed files with 1014692 additions and 0 deletions

13
node_modules/shiki/samples/Marko.sample generated vendored Normal file
View file

@ -0,0 +1,13 @@
<await(slowPromise) timeout=5000>
<@then>Done</@then>
<@catch|err|>
<if(err.name === "TimeoutError")>
Took too long to fetch the data!
</if>
<else>
Promise failed with ${err.message}.
</else>
</@catch>
</await>
# from https://markojs.com/docs/core-tags/

21
node_modules/shiki/samples/abap.sample generated vendored Normal file
View file

@ -0,0 +1,21 @@
report zldbread no standard page heading.
tables: lfa1.
data: begin of t occurs 0,
linfr like lfa1-lifnr,
name1 like lfa1-name1,
end of t.
start-of-selection.
get lfa1.
clear t.
move-corresponding lfa1 to t.
append t.
end-of-selection.
sort t by name1.
loop at t.
write: / t-name1, t-lifnr.
endloop.
*- From https://sapbrainsonline.com/abap-tutorial/codes/reading-logical-database-using-abap-program.html -*

27
node_modules/shiki/samples/actionscript-3.sample generated vendored Normal file
View file

@ -0,0 +1,27 @@
private function createParticles( count ):void{
var anchorPoint = 0;
for(var i:uint = 0; i < count; i++){
var particle:Object;
if( inactiveFireParticles.length > 0 ){
particle = inactiveFireParticles.shift();
}else {
particle = new Object();
fireParticles.push( particle );
}
particle.x = uint( Math.random() * frame.width * 0.1 ) + anchors[anchorPoint];
particle.y = frame.bottom;
particle.life = 70 + uint( Math.random() * 30 );
particle.size = 5 + uint( Math.random() * 10 );
if(particle.size > 12){
particle.size = 10;
}
particle.anchor = anchors[anchorPoint] + uint( Math.random() * 5 );
anchorPoint = (anchorPoint == 9)? 0 : anchorPoint + 1;
}
}
// From https://code.tutsplus.com/tutorials/actionscript-30-optimization-a-practical-example--active-11295

13
node_modules/shiki/samples/ada.sample generated vendored Normal file
View file

@ -0,0 +1,13 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Learn is
subtype Alphabet is Character range 'A' .. 'Z';
begin
Put_Line ("Learning Ada from " & Alphabet'First & " to " & Alphabet'Last);
end Learn;
-- From https://learn.adacore.com/

5
node_modules/shiki/samples/apex.sample generated vendored Normal file
View file

@ -0,0 +1,5 @@
String s1 = 'Salesforce and force.com';
String s2 = s1.remove('force');
System.debug( 's2'+ s2);// 'Sales and .com'
// From https://www.guru99.com/apex-tutorial.html

19
node_modules/shiki/samples/applescript.sample generated vendored Normal file
View file

@ -0,0 +1,19 @@
tell application "Address Book"
set bDayList to name of every person whose birth date is not missing value
choose from list bDayList with prompt "Whose birthday would you like?"
if the result is not false then
set aName to item 1 of the result
set theBirthday to birth date of person named aName
display dialog aName & "'s birthday is " & date string of theBirthday
end if
end tell
-- From https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html

29
node_modules/shiki/samples/ara.sample generated vendored Normal file
View file

@ -0,0 +1,29 @@
namespace MyNamespace;
use MyOtherNamespace\MyOtherClass;
use function MyOtherNamespace\my_other_function;
use const MyOtherNamespace\MY_OTHER_CONST;
const MY_CONST = 1;
type MyType = int;
interface MyInterface {
// ...
}
class MyClass {
// ...
}
enum MyEnum {
// ...
}
function my_function(): void {
// ...
}
https://ara-lang.io/fundamentals/structure.html

18
node_modules/shiki/samples/asm.sample generated vendored Normal file
View file

@ -0,0 +1,18 @@
segment .text ;code segment
global_start ;must be declared for linker
_start: ;tell linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
segment .data ;data segment
msg db 'Hello, world!',0xa ;our dear string
len equ $ - msg ;length of our dear string
;From https://www.tutorialspoint.com/assembly_programming/assembly_memory_segments.htm

16
node_modules/shiki/samples/astro.sample generated vendored Normal file
View file

@ -0,0 +1,16 @@
---
const name = "world"
---
<!DOCTYPE html>
<html>
<head>
<!-- This... is an Astro comment. -->
<title>Hello, {name}</title>
</head>
<body>
<main>
<h1>Hello, {name}</h1>
</main>
</body>
</html>

25
node_modules/shiki/samples/awk.sample generated vendored Normal file
View file

@ -0,0 +1,25 @@
#!/bin/awk -f
BEGIN {
# How many lines
lines=0;
total=0;
}
{
# this code is executed once for each line
# increase the number of files
lines++;
# increase the total size, which is field #1
total+=$1;
}
END {
# end, now output the total
print lines " lines read";
print "total is ", total;
if (lines > 0 ) {
print "average is ", total/lines;
} else {
print "average is 0";
}
}
#From https://www.grymoire.com/Unix/Awk.html

32
node_modules/shiki/samples/ballerina.sample generated vendored Normal file
View file

@ -0,0 +1,32 @@
import ballerina/io;
// This function definition has two parameters of type `int`.
// `returns` clause specifies type of return value.
function add(int x, int y) returns int {
int sum = x + y;
// `return` statement returns a value.
return sum;
}
public function main() {
io:println(add(5, 11));
}
import ballerina/io;
// This function definition has two parameters of type `int`.
// `returns` clause specifies type of return value.
function add(int x, int y) returns int {
int sum = x + y;
// `return` statement returns a value.
return sum;
}
public function main() {
io:println(add(5, 11));
}
// From https://ballerina.io/learn/by-example/functions

15
node_modules/shiki/samples/bat.sample generated vendored Normal file
View file

@ -0,0 +1,15 @@
@rem My First Batch file!
@echo off
echo Three
echo Two
echo One
echo Hello World!
pause
@rem From https://o7planning.org/11531/batch-scripting-language-tutorial-for-beginners

60
node_modules/shiki/samples/berry.sample generated vendored Normal file
View file

@ -0,0 +1,60 @@
class node
var v, l, r
def init(v, l, r)
self.v = v
self.l = l
self.r = r
end
def insert(v)
if v < self.v
if self.l
self.l.insert(v)
else
self.l = node(v)
end
else
if self.r
self.r.insert(v)
else
self.r = node (v)
end
end
end
def sort(l)
if (self.l) self.l.sort(l) end
l.push(self.v)
if (self.r) self.r.sort(l) end
end
end
class btree
var root
def insert(v)
if self.root
self.root.insert(v)
else
self.root = node(v)
end
end
def sort()
var l = []
if self.root
self.root.sort(l)
end
return l
end
end
var tree = btree()
tree.insert(-100)
tree.insert(5);
tree.insert(3);
tree.insert(9);
tree.insert(10);
tree.insert(10000000);
tree.insert(1);
tree.insert(-1);
tree.insert(-10);
print(tree.sort());
# From https://github.com/berry-lang/berry/blob/master/examples/bintree.be

47
node_modules/shiki/samples/bicep.sample generated vendored Normal file
View file

@ -0,0 +1,47 @@
@description('Name of the eventhub namespace')
param eventHubNamespaceName string
@description('Name of the eventhub name')
param eventHubName string
@description('The service principal')
param principalId string
// Create an event hub namespace
resource eventHubNamespace 'Microsoft.EventHub/namespaces@2021-01-01-preview' = {
name: eventHubNamespaceName
location: resourceGroup().location
sku: {
name: 'Standard'
tier: 'Standard'
capacity: 1
}
properties: {
zoneRedundant: true
}
}
// Create an event hub inside the namespace
resource eventHub 'Microsoft.EventHub/namespaces/eventhubs@2021-01-01-preview' = {
parent: eventHubNamespace
name: eventHubName
properties: {
messageRetentionInDays: 7
partitionCount: 1
}
}
// give Azure Pipelines Service Principal permissions against the event hub
var roleDefinitionAzureEventHubsDataOwner = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f526a384-b230-433a-b45c-95f59c4a2dec')
resource integrationTestEventHubReceiverNamespaceRoleAssignment 'Microsoft.Authorization/roleAssignments@2018-01-01-preview' = {
name: guid(principalId, eventHub.id, roleDefinitionAzureEventHubsDataOwner)
scope: eventHubNamespace
properties: {
roleDefinitionId: roleDefinitionAzureEventHubsDataOwner
principalId: principalId
}
}
// From https://dev.azure.com/johnnyreilly/blog-demos/_git/permissioning-azure-pipelines-bicep-role-assignments?path=/infra/main.bicep

47
node_modules/shiki/samples/blade.sample generated vendored Normal file
View file

@ -0,0 +1,47 @@
<x-app-layout :title="$post->title">
<x-ad/>
<x-post-header :post="$post" class="mb-8">
{!! $post->html !!}
@unless($post->isTweet())
@if($post->external_url)
<p class="mt-6">
<a href="{{ $post->external_url }}">
Read more</a>
<span class="text-xs text-gray-700">[{{ $post->external_url_host }}]</span>
</p>
@endif
@endunless
</x-post-header>
@include('front.newsletter.partials.block', [
'class' => 'mb-8',
])
<div class="mb-8">
@include('front.posts.partials.comments')
</div>
<x-slot name="seo">
<meta property="og:title" content="{{ $post->title }} | freek.dev"/>
<meta property="og:description" content="{{ $post->plain_text_excerpt }}"/>
<meta name="og:image" content="{{ url($post->getFirstMediaUrl('ogImage')) }}"/>
@foreach($post->tags as $tag)
<meta property="article:tag" content="{{ $tag->name }}"/>
@endforeach
<meta property="article:published_time" content="{{ optional($post->publish_date)->toIso8601String() }}"/>
<meta property="og:updated_time" content="{{ $post->updated_at->toIso8601String() }}"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:description" content="{{ $post->plain_text_excerpt }}"/>
<meta name="twitter:title" content="{{ $post->title }} | freek.dev"/>
<meta name="twitter:site" content="@freekmurze"/>
<meta name="twitter:image" content="{{ url($post->getFirstMediaUrl('ogImage')) }}"/>
<meta name="twitter:creator" content="@freekmurze"/>
</x-slot>
</x-app-layout>
#From https://freek.dev/2024-how-to-render-markdown-with-perfectly-highlighted-code-snippets

52
node_modules/shiki/samples/c.sample generated vendored Normal file
View file

@ -0,0 +1,52 @@
#include <stdio.h>
#define ARR_LEN 7
void qsort(int v[], int left, int right);
void printArr(int v[], int len);
int main()
{
int i;
int v[ARR_LEN] = { 4, 3, 1, 7, 9, 6, 2 };
printArr(v, ARR_LEN);
qsort(v, 0, ARR_LEN-1);
printArr(v, ARR_LEN);
return 0;
}
void qsort(int v[], int left, int right)
{
int i, last;
void swap(int v[], int i, int j);
if (left >= right)
return;
swap(v, left, (left + right) / 2);
last = left;
for (i = left+1; i <= right; i++)
if (v[i] < v[left])
swap(v, ++last, i);
swap(v, left, last);
qsort(v, left, last-1);
qsort(v, last+1, right);
}
void swap(int v[], int i, int j)
{
int temp;
temp = v[i];
v[i] = v[j];
v[j] = temp;
}
void printArr(int v[], int len)
{
int i;
for (i = 0; i < len; i++)
printf("%d ", v[i]);
printf("\n");
}
// From https://github.com/Heatwave/The-C-Programming-Language-2nd-Edition/blob/master/chapter-4-functions-and-program-structure/8.qsort.c

19
node_modules/shiki/samples/cadence.sample generated vendored Normal file
View file

@ -0,0 +1,19 @@
pub contract HelloWorld {
// Declare a public field of type String.
//
// All fields must be initialized in the init() function.
pub let greeting: String
// The init() function is required if the contract contains any fields.
init() {
self.greeting = "Hello, World!"
}
// Public function that returns our friendly greeting!
pub fun hello(): String {
return self.greeting
}
}
// From https://docs.onflow.org/cadence/tutorial/02-hello-world/

53
node_modules/shiki/samples/clarity.sample generated vendored Normal file
View file

@ -0,0 +1,53 @@
(impl-trait .sip010-ft-trait.sip010-ft-trait)
;; SIP010 trait on mainnet
;; (impl-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)
(define-constant contract-owner tx-sender)
(define-constant err-owner-only (err u100))
(define-constant err-not-token-owner (err u101))
;; No maximum supply!
(define-fungible-token clarity-coin)
(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))
(begin
(asserts! (is-eq tx-sender sender) err-owner-only)
(try! (ft-transfer? clarity-coin amount sender recipient))
(match memo to-print (print to-print) 0x)
(ok true)
)
)
(define-read-only (get-name)
(ok "Clarity Coin")
)
(define-read-only (get-symbol)
(ok "CC")
)
(define-read-only (get-decimals)
(ok u0)
)
(define-read-only (get-balance (who principal))
(ok (ft-get-balance clarity-coin who))
)
(define-read-only (get-total-supply)
(ok (ft-get-supply clarity-coin))
)
(define-read-only (get-token-uri)
(ok none)
)
(define-public (mint (amount uint) (recipient principal))
(begin
(asserts! (is-eq tx-sender contract-owner) err-owner-only)
(ft-mint? clarity-coin amount recipient)
)
)
;; From https://github.com/clarity-lang/book/blob/main/projects/sip010-ft/contracts/clarity-coin.clar

14
node_modules/shiki/samples/clojure.sample generated vendored Normal file
View file

@ -0,0 +1,14 @@
(let [my-vector [1 2 3 4]
my-map {:fred "ethel"}
my-list (list 4 3 2 1)]
(list
(conj my-vector 5)
(assoc my-map :ricky "lucy")
(conj my-list 5)
;the originals are intact
my-vector
my-map
my-list))
-> ([1 2 3 4 5] {:ricky "lucy", :fred "ethel"} (5 4 3 2 1) [1 2 3 4] {:fred "ethel"} (4 3 2 1))
;From https://clojure.org/about/functional_programming#_immutable_data_structures

36
node_modules/shiki/samples/cmake.sample generated vendored Normal file
View file

@ -0,0 +1,36 @@
# Almost all CMake files should start with this
# You should always specify a range with the newest
# and oldest tested versions of CMake. This will ensure
# you pick up the best policies.
cmake_minimum_required(VERSION 3.1...3.23)
# This is your project statement. You should always list languages;
# Listing the version is nice here since it sets lots of useful variables
project(
ModernCMakeExample
VERSION 1.0
LANGUAGES CXX)
# If you set any CMAKE_ variables, that can go here.
# (But usually don't do this, except maybe for C++ standard)
# Find packages go here.
# You should usually split this into folders, but this is a simple example
# This is a "default" library, and will match the *** variable setting.
# Other common choices are STATIC, SHARED, and MODULE
# Including header files here helps IDEs but is not required.
# Output libname matches target name, with the usual extensions on your system
add_library(MyLibExample simple_lib.cpp simple_lib.hpp)
# Link each target with other targets or add options, etc.
# Adding something we can run - Output name matches target name
add_executable(MyExample simple_example.cpp)
# Make sure you link your targets with this command. It can also link libraries and
# even flags, so linking a target that does not exist will not give a configure-time error.
target_link_libraries(MyExample PRIVATE MyLibExample)
# From https://cliutils.gitlab.io/modern-cmake/chapters/basics/example.html

12
node_modules/shiki/samples/cobol.sample generated vendored Normal file
View file

@ -0,0 +1,12 @@
*> setup the identification division
IDENTIFICATION DIVISION.
*> setup the program id
PROGRAM-ID. HELLO.
*> setup the procedure division (like 'main' function)
PROCEDURE DIVISION.
*> print a string
DISPLAY 'WILLKOMMEN'.
*> end our program
STOP RUN.
*> From https://medium.com/@yvanscher/7-cobol-examples-with-explanations-ae1784b4d576

104
node_modules/shiki/samples/codeql.sample generated vendored Normal file
View file

@ -0,0 +1,104 @@
// a query
/**
* @name LDAP query built from user-controlled sources
* @description Building an LDAP query from user-controlled sources is vulnerable to insertion of
* malicious LDAP code by the user.
* @kind path-problem
* @problem.severity error
* @id py/ldap-injection
* @tags experimental
* security
* external/cwe/cwe-090
*/
import python
import experimental.semmle.python.security.injection.LDAP
import DataFlow::PathGraph
from LDAPInjectionFlowConfig config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ LDAP query parameter comes from $@.", sink.getNode(),
"This", source.getNode(), "a user-provided value"
// a concept
module LDAPEscape {
abstract class Range extends DataFlow::Node {
abstract DataFlow::Node getAnInput();
}
}
class LDAPEscape extends DataFlow::Node {
LDAPEscape::Range range;
LDAPEscape() { this = range }
DataFlow::Node getAnInput() { result = range.getAnInput() }
}
// a library modeling
private module LDAP2 {
private class LDAP2QueryMethods extends string {
LDAP2QueryMethods() {
this in ["search", "search_s", "search_st", "search_ext", "search_ext_s"]
}
}
private class LDAP2Query extends DataFlow::CallCfgNode, LDAPQuery::Range {
DataFlow::Node ldapQuery;
LDAP2Query() {
exists(DataFlow::AttrRead searchMethod |
this.getFunction() = searchMethod and
API::moduleImport("ldap").getMember("initialize").getACall() =
searchMethod.getObject().getALocalSource() and
searchMethod.getAttributeName() instanceof LDAP2QueryMethods and
(
ldapQuery = this.getArg(0)
or
(
ldapQuery = this.getArg(2) or
ldapQuery = this.getArgByName("filterstr")
)
)
)
}
override DataFlow::Node getQuery() { result = ldapQuery }
}
private class LDAP2EscapeDNCall extends DataFlow::CallCfgNode, LDAPEscape::Range {
LDAP2EscapeDNCall() {
this = API::moduleImport("ldap").getMember("dn").getMember("escape_dn_chars").getACall()
}
override DataFlow::Node getAnInput() { result = this.getArg(0) }
}
private class LDAP2EscapeFilterCall extends DataFlow::CallCfgNode, LDAPEscape::Range {
LDAP2EscapeFilterCall() {
this =
API::moduleImport("ldap").getMember("filter").getMember("escape_filter_chars").getACall()
}
override DataFlow::Node getAnInput() { result = this.getArg(0) }
}
}
// a taint flow config
class LDAPInjectionFlowConfig extends TaintTracking::Configuration {
LDAPInjectionFlowConfig() { this = "LDAPInjectionFlowConfig" }
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
override predicate isSink(DataFlow::Node sink) { sink = any(LDAPQuery ldapQuery).getQuery() }
override predicate isSanitizer(DataFlow::Node sanitizer) {
sanitizer = any(LDAPEscape ldapEsc).getAnInput()
}
}
// From https://github.com/github/codeql/pull/5443/files

30
node_modules/shiki/samples/coffee.sample generated vendored Normal file
View file

@ -0,0 +1,30 @@
# Assignment:
number = 42
opposite = true
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x * x
# Arrays:
list = [1, 2, 3, 4, 5]
# Objects:
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x
# Splats:
race = (winner, runners...) ->
print winner, runners
# Existence:
alert "I knew it!" if elvis?
# Array comprehensions:
cubes = (math.cube num for num in list)
# From https://coffeescript.org/#overview

21
node_modules/shiki/samples/cpp.sample generated vendored Normal file
View file

@ -0,0 +1,21 @@
// Working of implicit type-conversion
#include <iostream>
using namespace std;
int main() {
int num_int;
double num_double = 9.99;
// implicit conversion
// assigning a double value to an int variable
num_int = num_double;
cout << "num_int = " << num_int << endl;
cout << "num_double = " << num_double << endl;
return 0;
}
// From https://www.programiz.com/cpp-programming/type-conversion

43
node_modules/shiki/samples/crystal.sample generated vendored Normal file
View file

@ -0,0 +1,43 @@
struct Foo(T)
end
Foo(Int32)
# ---
struct Foo
end
# struct Bar < Foo
# end
# Error in ./struct/struct.cr:10: can't extend non-abstract struct Foo
abstract struct AbstractFoo
end
struct Bar < AbstractFoo
end
# ---
struct Test
def initialize(@test : String)
end
end
Test.new("foo")
# ---
struct User
property name, age
def initialize(@name : String, @age : Int32)
end
def print
puts "#{age} - #{name}"
end
end
puts User.new("osman", 3).name
User.new("ali", 9).print
# From https://github.com/askn/crystal-by-example/blob/master/struct/struct.cr

33
node_modules/shiki/samples/csharp.sample generated vendored Normal file
View file

@ -0,0 +1,33 @@
using KCTest.Infrastructure.Database;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace KCTest.API
{
public class Program
{
public static void Main(string[] args)
{
var host = CreateHostBuilder(args).Build();
using (var scope = host.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<KCTestContext>();
db.Database.Migrate();
}
host.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
// From https://github.com/Jadhielv/KCTest/blob/master/Backend/src/KCTest.API/Program.cs

19
node_modules/shiki/samples/css.sample generated vendored Normal file
View file

@ -0,0 +1,19 @@
.Aligner {
display: flex;
align-items: center;
justify-content: center;
}
.Aligner-item {
max-width: 50%;
}
.Aligner-item--top {
align-self: flex-start;
}
.Aligner-item--bottom {
align-self: flex-end;
}
/* From https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/ */

108
node_modules/shiki/samples/cue.sample generated vendored Normal file
View file

@ -0,0 +1,108 @@
package kube
service: [ID=_]: {
apiVersion: "v1"
kind: "Service"
metadata: {
name: ID
labels: {
app: ID // by convention
domain: "prod" // always the same in the given files
component: #Component // varies per directory
}
}
spec: {
// Any port has the following properties.
ports: [...{
port: int
protocol: *"TCP" | "UDP" // from the Kubernetes definition
name: string | *"client"
}]
selector: metadata.labels // we want those to be the same
}
}
deployment: [ID=_]: {
apiVersion: "apps/v1"
kind: "Deployment"
metadata: name: ID
spec: {
// 1 is the default, but we allow any number
replicas: *1 | int
template: {
metadata: labels: {
app: ID
domain: "prod"
component: #Component
}
// we always have one namesake container
spec: containers: [{name: ID}]
}
}
}
#Component: string
daemonSet: [ID=_]: _spec & {
apiVersion: "apps/v1"
kind: "DaemonSet"
_name: ID
}
statefulSet: [ID=_]: _spec & {
apiVersion: "apps/v1"
kind: "StatefulSet"
_name: ID
}
deployment: [ID=_]: _spec & {
apiVersion: "apps/v1"
kind: "Deployment"
_name: ID
spec: replicas: *1 | int
}
configMap: [ID=_]: {
metadata: name: ID
metadata: labels: component: #Component
}
_spec: {
_name: string
metadata: name: _name
metadata: labels: component: #Component
spec: selector: {}
spec: template: {
metadata: labels: {
app: _name
component: #Component
domain: "prod"
}
spec: containers: [{name: _name}]
}
}
// Define the _export option and set the default to true
// for all ports defined in all containers.
_spec: spec: template: spec: containers: [...{
ports: [...{
_export: *true | false // include the port in the service
}]
}]
for x in [deployment, daemonSet, statefulSet] for k, v in x {
service: "\(k)": {
spec: selector: v.spec.template.metadata.labels
spec: ports: [
for c in v.spec.template.spec.containers
for p in c.ports
if p._export {
let Port = p.containerPort // Port is an alias
port: *Port | int
targetPort: *Port | int
},
]
}
}

18
node_modules/shiki/samples/d.sample generated vendored Normal file
View file

@ -0,0 +1,18 @@
void main()
{
import std.datetime.stopwatch : benchmark;
import std.math, std.parallelism, std.stdio;
auto logs = new double[100_000];
auto bm = benchmark!({
foreach (i, ref elem; logs)
elem = log(1.0 + i);
}, {
foreach (i, ref elem; logs.parallel)
elem = log(1.0 + i);
})(100); // number of executions of each tested function
writefln("Linear init: %s msecs", bm[0].total!"msecs");
writefln("Parallel init: %s msecs", bm[1].total!"msecs");
}
// From https://dlang.org/

32
node_modules/shiki/samples/dart.sample generated vendored Normal file
View file

@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:flutter_workshop/screens/about_screen.dart';
import 'package:flutter_workshop/screens/home_demo_screen.dart';
import 'package:flutter_workshop/screens/home_screen.dart';
import 'package:flutter_workshop/screens/product_detail_screen.dart';
import 'package:flutter_workshop/screens/product_screen.dart';
import 'package:flutter_workshop/screens/random_words_screen.dart';
import 'package:flutter_workshop/screens/unknown_screen.dart';
import 'package:device_simulator/device_simulator.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: '/',
routes: {
HomeScreen.routeName: (_) => DeviceSimulator(
brightness: Brightness.dark, enable: true, child: HomeScreen()),
ProductScreen.routeName: (_) => ProductScreen(),
ProductDetailScreen.routeName: (_) => ProductDetailScreen(),
RandomWordsScreen.routeName: (_) => RandomWordsScreen(),
HomeDemoScreen.routeName: (_) => HomeDemoScreen(),
AboutScreen.routeName: (_) => AboutScreen()
},
onUnknownRoute: (_) =>
MaterialPageRoute(builder: (_) => UnknownScreen()));
}
}
// From https://github.com/Jadhielv/flutter-workshop/blob/master/lib/main.dart

19
node_modules/shiki/samples/dax.sample generated vendored Normal file
View file

@ -0,0 +1,19 @@
-- COALESCE returns the first non-blank of its arguments
-- It is commonly used to provide default values to expressions
-- that might result in a blank
EVALUATE
SELECTCOLUMNS (
TOPN ( 10, Store ),
"Store name", Store[Store Name],
"Manager",
COALESCE ( Store[Area Manager], "** Not Assigned **" ),
"Years open",
DATEDIFF (
Store[Open Date],
COALESCE ( Store[Close Date], TODAY () ),
YEAR
)
)
ORDER BY [Manager]
-- From https://dax.guide/coalesce/

28
node_modules/shiki/samples/diff.sample generated vendored Normal file
View file

@ -0,0 +1,28 @@
$ cat file1.txt
cat
mv
comm
cp
$ cat file2.txt
cat
cp
diff
comm
$ diff -c file1.txt file2.txt
*** file1.txt Thu Jan 11 08:52:37 2018
--- file2.txt Thu Jan 11 08:53:01 2018
***************
*** 1,4 ****
cat
- mv
- comm
cp
--- 1,4 ----
cat
cp
+ diff
+ comm
# From https://www.geeksforgeeks.org/diff-command-linux-examples/

77
node_modules/shiki/samples/dm.sample generated vendored Normal file
View file

@ -0,0 +1,77 @@
//Allows you to set a theme for a set of areas without tying them to looping sounds explicitly
/datum/component/area_sound_manager
//area -> looping sound type
var/list/area_to_looping_type = list()
//Current sound loop
var/datum/looping_sound/our_loop
//A list of "acceptable" z levels to be on. If you leave this, we're gonna delete ourselves
var/list/accepted_zs
//The timer id of our current start delay, if it exists
var/timerid
/datum/component/area_sound_manager/Initialize(area_loop_pairs, change_on, remove_on, acceptable_zs)
if(!ismovable(parent))
return
area_to_looping_type = area_loop_pairs
accepted_zs = acceptable_zs
change_the_track()
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/react_to_move)
RegisterSignal(parent, COMSIG_MOVABLE_Z_CHANGED, .proc/react_to_z_move)
RegisterSignal(parent, change_on, .proc/handle_change)
RegisterSignal(parent, remove_on, .proc/handle_removal)
/datum/component/area_sound_manager/Destroy(force, silent)
QDEL_NULL(our_loop)
. = ..()
/datum/component/area_sound_manager/proc/react_to_move(datum/source, atom/oldloc, dir, forced)
SIGNAL_HANDLER
var/list/loop_lookup = area_to_looping_type
if(loop_lookup[get_area(oldloc)] == loop_lookup[get_area(parent)])
return
change_the_track(TRUE)
/datum/component/area_sound_manager/proc/react_to_z_move(datum/source, old_z, new_z)
SIGNAL_HANDLER
if(!length(accepted_zs) || (new_z in accepted_zs))
return
qdel(src)
/datum/component/area_sound_manager/proc/handle_removal(datum/source)
SIGNAL_HANDLER
qdel(src)
/datum/component/area_sound_manager/proc/handle_change(datum/source)
SIGNAL_HANDLER
change_the_track()
/datum/component/area_sound_manager/proc/change_the_track(skip_start = FALSE)
var/time_remaining = 0
if(our_loop)
var/our_id = our_loop.timerid || timerid
if(our_id)
time_remaining = timeleft(our_id, SSsound_loops) || 0
//Time left will sometimes return negative values, just ignore them and start a new sound loop now
time_remaining = max(time_remaining, 0)
QDEL_NULL(our_loop)
var/area/our_area = get_area(parent)
var/new_loop_type = area_to_looping_type[our_area]
if(!new_loop_type)
return
our_loop = new new_loop_type(parent, FALSE, TRUE, skip_start)
//If we're still playing, wait a bit before changing the sound so we don't double up
if(time_remaining)
timerid = addtimer(CALLBACK(src, .proc/start_looping_sound), time_remaining, TIMER_UNIQUE | TIMER_CLIENT_TIME | TIMER_STOPPABLE | TIMER_NO_HASH_WAIT | TIMER_DELETE_ME, SSsound_loops)
return
timerid = null
our_loop.start()
/datum/component/area_sound_manager/proc/start_looping_sound()
timerid = null
if(our_loop)
our_loop.start()

19
node_modules/shiki/samples/docker.sample generated vendored Normal file
View file

@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY ../engine/examples ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
# From https://docs.docker.com/samples/dotnetcore/

8
node_modules/shiki/samples/elixir.sample generated vendored Normal file
View file

@ -0,0 +1,8 @@
# module_name.ex
defmodule ModuleName do
def hello do
IO.puts "Hello World"
end
end
# From https://elixir-lang.org/crash-course.html#elixir

66
node_modules/shiki/samples/elm.sample generated vendored Normal file
View file

@ -0,0 +1,66 @@
module Main exposing (..)
-- Press buttons to increment and decrement a counter.
--
-- Read how it works:
-- https://guide.elm-lang.org/architecture/buttons.html
--
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
-- MAIN
main =
Browser.sandbox { init = init, update = update, view = view }
-- MODEL
type alias Model = Int
init : Model
init =
0
-- UPDATE
type Msg
= Increment
| Decrement
update : Msg -> Model -> Model
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
-- VIEW
view : Model -> Html Msg
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
-- From https://elm-lang.org/examples/buttons

69
node_modules/shiki/samples/erb.sample generated vendored Normal file
View file

@ -0,0 +1,69 @@
require "erb"
# Build template data class.
class Product
def initialize( code, name, desc, cost )
@code = code
@name = name
@desc = desc
@cost = cost
@features = [ ]
end
def add_feature( feature )
@features << feature
end
# Support templating of member data.
def get_binding
binding
end
# ...
end
# Create template.
template = %{
<html>
<head><title>Ruby Toys -- <%= @name %></title></head>
<body>
<h1><%= @name %> (<%= @code %>)</h1>
<p><%= @desc %></p>
<ul>
<% @features.each do |f| %>
<li><b><%= f %></b></li>
<% end %>
</ul>
<p>
<% if @cost < 10 %>
<b>Only <%= @cost %>!!!</b>
<% else %>
Call for a price, today!
<% end %>
</p>
</body>
</html>
}.gsub(/^ /, '')
rhtml = ERB.new(template)
# Set up template data.
toy = Product.new( "TZ-1002",
"Rubysapien",
"Geek's Best Friend! Responds to Ruby commands...",
999.95 )
toy.add_feature("Listens for verbal commands in the Ruby language!")
toy.add_feature("Ignores Perl, Java, and all C variants.")
toy.add_feature("Karate-Chop Action!!!")
toy.add_feature("Matz signature on left leg.")
toy.add_feature("Gem studded eyes... Rubies, of course!")
# Produce result.
rhtml.run(toy.get_binding)
# From https://docs.ruby-lang.org/en/2.3.0/ERB.html#class-ERB-label-Examples

50
node_modules/shiki/samples/erlang.sample generated vendored Normal file
View file

@ -0,0 +1,50 @@
%% File: person.hrl
%%-----------------------------------------------------------
%% Data Type: person
%% where:
%% name: A string (default is undefined).
%% age: An integer (default is undefined).
%% phone: A list of integers (default is []).
%% dict: A dictionary containing various information
%% about the person.
%% A {Key, Value} list (default is the empty list).
%%------------------------------------------------------------
-record(person, {name, age, phone = [], dict = []}).
-module(person).
-include("person.hrl").
-compile(export_all). % For test purposes only.
%% This creates an instance of a person.
%% Note: The phone number is not supplied so the
%% default value [] will be used.
make_hacker_without_phone(Name, Age) ->
#person{name = Name, age = Age,
dict = [{computer_knowledge, excellent},
{drinks, coke}]}.
%% This demonstrates matching in arguments
print(#person{name = Name, age = Age,
phone = Phone, dict = Dict}) ->
io:format("Name: ~s, Age: ~w, Phone: ~w ~n"
"Dictionary: ~w.~n", [Name, Age, Phone, Dict]).
%% Demonstrates type testing, selector, updating.
birthday(P) when is_record(P, person) ->
P#person{age = P#person.age + 1}.
register_two_hackers() ->
Hacker1 = make_hacker_without_phone("Joe", 29),
OldHacker = birthday(Hacker1),
% The central_register_server should have
% an interface function for this.
central_register_server ! {register_person, Hacker1},
central_register_server ! {register_person,
OldHacker#person{name = "Robert",
phone = [0,8,3,2,4,5,3,1]}}.
%% From https://erlang.org/doc/programming_examples/records.html#a-longer-example

13
node_modules/shiki/samples/fish.sample generated vendored Normal file
View file

@ -0,0 +1,13 @@
function fish_prompt
# A simple prompt. Displays the current directory
# (which fish stores in the $PWD variable)
# and then a user symbol - a '►' for a normal user and a '#' for root.
set -l user_char '►'
if fish_is_root_user
set user_char '#'
end
echo (set_color yellow)$PWD (set_color purple)$user_char
end
# From https://fishshell.com/docs/current/language.html#functions

13
node_modules/shiki/samples/fsharp.sample generated vendored Normal file
View file

@ -0,0 +1,13 @@
type Customer(firstName, middleInitial, lastName) =
member this.FirstName = firstName
member this.MiddleInitial = middleInitial
member this.LastName = lastName
member this.SayFullName() =
$"{this.FirstName} {this.MiddleInitial} {this.LastName}"
let customer = Customer("Emillia", "C", "Miller")
printfn $"Hello, I'm {customer.SayFullName()}!"
// From https://dotnet.microsoft.com/languages/fsharp

47
node_modules/shiki/samples/fsl.sample generated vendored Normal file
View file

@ -0,0 +1,47 @@
machine_name : "TCP/IP";
machine_reference : "http://www.texample.net/tikz/examples/tcp-state-machine/";
machine_version : 1.0.0;
machine_author : "John Haugeland <stonecypher@gmail.com>";
machine_license : MIT;
jssm_version : >= 5.0.0;
Closed 'Passive open' -> Listen;
Closed 'Active Open / SYN' -> SynSent;
Listen 'Close' -> Closed;
Listen 'Send / SYN' -> SynSent;
Listen 'SYN / SYN+ACK' -> SynRcvd;
SynSent 'Close' -> Closed;
SynSent 'SYN / SYN+ACK' -> SynRcvd;
SynSent 'SYN+ACK / ACK' -> Established;
SynRcvd 'Timeout / RST' -> Closed;
SynRcvd 'Close / FIN' -> FinWait1;
SynRcvd 'ACK' -> Established;
Established 'Close / FIN' -> FinWait1;
Established 'FIN / ACK' -> CloseWait;
FinWait1 'FIN / ACK' -> Closing; // the source diagram has this action wrong
FinWait1 'FIN+ACK / ACK' -> TimeWait;
FinWait1 'ACK / Nothing' -> FinWait2; // see http://www.cs.odu.edu/~cs779/spring17/lectures/architecture_files/image009.jpg
FinWait2 'FIN / ACK' -> TimeWait;
Closing 'ACK' -> TimeWait;
TimeWait 'Up to 2*MSL' -> Closed;
CloseWait 'Close / FIN' -> LastAck;
LastAck 'ACK' -> Closed;
# From https://github.com/StoneCypher/jssm/blob/main/src/machines/linguist/tcp%20ip.fsl

95
node_modules/shiki/samples/gdresource.sample generated vendored Normal file
View file

@ -0,0 +1,95 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Example.gd" type="Script" id=1]
[sub_resource type="Environment" id=1]
background_mode = 4
tonemap_mode = 3
glow_enabled = true
glow_blend_mode = 0
[sub_resource type="Animation" id=2]
resource_name = "RESET"
tracks/0/type = "value"
tracks/0/path = NodePath("CanvasLayer/Panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 0, 0, 0, 0 ) ]
}
[sub_resource type="Animation" id=3]
resource_name = "dim"
tracks/0/type = "value"
tracks/0/path = NodePath("CanvasLayer/Panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 0, 0, 0, 0 ), Color( 0, 0, 0, 0.501961 ) ]
}
[sub_resource type="Animation" id=4]
tracks/0/type = "value"
tracks/0/path = NodePath("CanvasLayer/Panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 0, 0, 0, 1 ), Color( 0, 0, 0, 0 ) ]
}
[sub_resource type="Animation" id=5]
tracks/0/type = "value"
tracks/0/path = NodePath("CanvasLayer/Panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 0, 0, 0, 0 ), Color( 0, 0, 0, 1 ) ]
}
[node name="Main" type="Node"]
script = ExtResource( 1 )
[node name="World" type="Node2D" parent="."]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( 1 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = 128
[node name="Panel" type="Panel" parent="CanvasLayer"]
modulate = Color( 0, 0, 0, 0 )
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="FadePlayer" type="AnimationPlayer" parent="."]
anims/RESET = SubResource( 2 )
anims/dim = SubResource( 3 )
anims/fade_in = SubResource( 4 )
anims/fade_out = SubResource( 5 )
; from https://github.com/godotengine/godot-vscode-plugin/blob/cdc550a412dfffd26dfe7351e429b73c819d68d0/syntaxes/examples/Example.tscn

57
node_modules/shiki/samples/gdscript.sample generated vendored Normal file
View file

@ -0,0 +1,57 @@
extends Node
class_name TestClass2
@icon("res://path/to/icon.png")
# ******************************************************************************
@export var x : int
@export var y : int
@export var z : String
@export_node_path(Resource) var resource_name
var array_a: Array[int] = [1, 2, 3]
var array_b: Array[String] = ['1', '2', '3']
@rpc
func remote_function_a():
pass
@rpc(any_peer, call_local, unreliable)
func remote_function_b():
pass
# ------------------------------------------------------------------------------
func f():
await $Button.button_up
super()
super.some_function()
for i in range(1): # `in` is a control keyword
print(i in range(1)) # `in` is an operator keyword
func lambda_test():
var lambda_a = func(param1, param2, param3):
pass
var lambda_b = func(param1, param2=func_a(10, 1.0, 'test')):
pass
var lambda_c = func(param1 = false, param2: bool = false, param3 := false):
pass
lambda_a.call()
lambda_b.call()
lambda_c.call()
# ------------------------------------------------------------------------------
signal changed(new_value)
var warns_when_changed = "some value":
get:
return warns_when_changed
set(value):
changed.emit(value)
warns_when_changed = value
# ------------------------------------------------------------------------------
# from https://github.com/godotengine/godot-vscode-plugin/blob/cdc550a412dfffd26dfe7351e429b73c819d68d0/syntaxes/examples/gdscript2.gd

97
node_modules/shiki/samples/gdshader.sample generated vendored Normal file
View file

@ -0,0 +1,97 @@
shader_type spatial;
render_mode wireframe;
const lowp vec3 v[1] = lowp vec3[1] ( vec3(0, 0, 1) );
void fn() {
// The required amount of scalars
vec4 a0 = vec4(0.0, 1.0, 2.0, 3.0);
// Complementary vectors and/or scalars
vec4 a1 = vec4(vec2(0.0, 1.0), vec2(2.0, 3.0));
vec4 a2 = vec4(vec3(0.0, 1.0, 2.0), 3.0);
// A single scalar for the whole vector
vec4 a3 = vec4(0.0);
mat2 m2 = mat2(vec2(1.0, 0.0), vec2(0.0, 1.0));
mat3 m3 = mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0));
mat4 identity = mat4(1.0);
mat3 basis = mat3(identity);
mat4 m4 = mat4(basis);
mat2 m2a = mat2(m4);
vec4 a = vec4(0.0, 1.0, 2.0, 3.0);
vec3 b = a.rgb; // Creates a vec3 with vec4 components.
vec3 b1 = a.ggg; // Also valid; creates a vec3 and fills it with a single vec4 component.
vec3 b2 = a.bgr; // "b" will be vec3(2.0, 1.0, 0.0).
vec3 b3 = a.xyz; // Also rgba, xyzw are equivalent.
vec3 b4 = a.stp; // And stpq (for texture coordinates).
b.bgr = a.rgb; // Valid assignment. "b"'s "blue" component will be "a"'s "red" and vice versa.
lowp vec4 v0 = vec4(0.0, 1.0, 2.0, 3.0); // low precision, usually 8 bits per component mapped to 0-1
mediump vec4 v1 = vec4(0.0, 1.0, 2.0, 3.0); // medium precision, usually 16 bits or half float
highp vec4 v2 = vec4(0.0, 1.0, 2.0, 3.0); // high precision, uses full float or integer range (default)
const vec2 aa = vec2(0.0, 1.0);
vec2 bb;
bb = aa; // valid
const vec2 V1 = vec2(1, 1), V2 = vec2(2, 2);
float fa = 1.0;
float fb = 1.0f;
float fc = 1e-1;
uint ua = 1u;
uint ub = uint(1);
bool cond = false;
// `if` and `else`.
if (cond) {
} else {
}
// Ternary operator.
// This is an expression that behaves like `if`/`else` and returns the value.
// If `cond` evaluates to `true`, `result` will be `9`.
// Otherwise, `result` will be `5`.
int i, result = cond ? 9 : 5;
// `switch`.
switch (i) { // `i` should be a signed integer expression.
case -1:
break;
case 0:
return; // `break` or `return` to avoid running the next `case`.
case 1: // Fallthrough (no `break` or `return`): will run the next `case`.
case 2:
break;
//...
default: // Only run if no `case` above matches. Optional.
break;
}
// `for` loop. Best used when the number of elements to iterate on
// is known in advance.
for (int i = 0; i < 10; i++) {
}
// `while` loop. Best used when the number of elements to iterate on
// is not known in advance.
while (cond) {
}
// `do while`. Like `while`, but always runs at least once even if `cond`
// never evaluates to `true`.
do {
} while (cond);
}
const float PI_ = 3.14159265358979323846;
struct PointLight {
vec3 position;
vec3 color;
float intensity;
};
struct Scene {
PointLight lights[2];
};
// from https://github.com/godotengine/godot-vscode-plugin/blob/cdc550a412dfffd26dfe7351e429b73c819d68d0/syntaxes/examples/example2.gdshader

86
node_modules/shiki/samples/glsl.sample generated vendored Normal file
View file

@ -0,0 +1,86 @@
#version 330
const float PI = 3.1415926535897932384626433832795;
const float waveLength = 20.0;
const float waveAmplitude = 1.0;
const float specularReflectivity = 0.4;
const float shineDamper = 20.0;
layout(location = 0) in vec2 in_position;
layout(location = 1) in vec4 in_indicators;
out vec4 pass_clipSpaceGrid;
out vec4 pass_clipSpaceReal;
out vec3 pass_normal;
out vec3 pass_toCameraVector;
out vec3 pass_specular;
out vec3 pass_diffuse;
uniform float height;
uniform vec3 cameraPos;
uniform float waveTime;
uniform vec3 lightDirection;
uniform vec3 lightColour;
uniform vec2 lightBias;
uniform mat4 projectionViewMatrix;
vec3 calcSpecularLighting(vec3 toCamVector, vec3 toLightVector, vec3 normal){
vec3 reflectedLightDirection = reflect(-toLightVector, normal);
float specularFactor = dot(reflectedLightDirection , toCamVector);
specularFactor = max(specularFactor,0.0);
specularFactor = pow(specularFactor, shineDamper);
return specularFactor * specularReflectivity * lightColour;
}
vec3 calculateDiffuseLighting(vec3 toLightVector, vec3 normal){
float brightness = max(dot(toLightVector, normal), 0.0);
return (lightColour * lightBias.x) + (brightness * lightColour * lightBias.y);
}
vec3 calcNormal(vec3 vertex0, vec3 vertex1, vec3 vertex2){
vec3 tangent = vertex1 - vertex0;
vec3 bitangent = vertex2 - vertex0;
return normalize(cross(tangent, bitangent));
}
float generateOffset(float x, float z){
float radiansX = (x / waveLength + waveTime) * 2.0 * PI;
float radiansZ = (z / waveLength + waveTime) * 2.0 * PI;
return waveAmplitude * 0.5 * (sin(radiansZ) + cos(radiansX));
}
vec3 applyDistortion(vec3 vertex){
float xDistortion = generateOffset(vertex.x, vertex.z);
float yDistortion = generateOffset(vertex.x, vertex.z);
float zDistortion = generateOffset(vertex.x, vertex.z);
return vertex + vec3(xDistortion, yDistortion, zDistortion);
}
void main(void){
vec3 currentVertex = vec3(in_position.x, height, in_position.y);
vec3 vertex1 = currentVertex + vec3(in_indicators.x, 0.0, in_indicators.y);
vec3 vertex2 = currentVertex + vec3(in_indicators.z, 0.0, in_indicators.w);
pass_clipSpaceGrid = projectionViewMatrix * vec4(currentVertex, 1.0);
currentVertex = applyDistortion(currentVertex);
vertex1 = applyDistortion(vertex1);
vertex2 = applyDistortion(vertex2);
pass_normal = calcNormal(currentVertex, vertex1, vertex2);
pass_clipSpaceReal = projectionViewMatrix * vec4(currentVertex, 1.0);
gl_Position = pass_clipSpaceReal;
pass_toCameraVector = normalize(cameraPos - currentVertex);
vec3 toLightVector = -normalize(lightDirection);
pass_specular = calcSpecularLighting(pass_toCameraVector, toLightVector, pass_normal);
pass_diffuse = calculateDiffuseLighting(toLightVector, pass_normal);
}
// From https://github.com/TheThinMatrix/WaterStep10/blob/master/water/waterRendering/waterVertex.glsl

18
node_modules/shiki/samples/go.sample generated vendored Normal file
View file

@ -0,0 +1,18 @@
package main
import (
"fmt"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
// From https://golang.org/doc/articles/wiki/#tmp_3

15
node_modules/shiki/samples/hcl.sample generated vendored Normal file
View file

@ -0,0 +1,15 @@
io_mode = "async"
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "main" {
command = ["/usr/local/bin/awesome-app", "server"]
}
process "mgmt" {
command = ["/usr/local/bin/awesome-app", "mgmt"]
}
}
# From: https://github.com/hashicorp/hcl/blob/main/README.md

27
node_modules/shiki/samples/html.sample generated vendored Normal file
View file

@ -0,0 +1,27 @@
<style>
.Aligner {
display: flex;
align-items: center;
justify-content: center;
}
.Aligner-item {
max-width: 50%;
}
.Aligner-item--top {
align-self: flex-start;
}
.Aligner-item--bottom {
align-self: flex-end;
}
</style>
<div class="Aligner">
<div class="Aligner-item Aligner-item--top">…</div>
<div class="Aligner-item">…</div>
<div class="Aligner-item Aligner-item--bottom">…</div>
</div>
<!-- From https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/ -->

16
node_modules/shiki/samples/http.sample generated vendored Normal file
View file

@ -0,0 +1,16 @@
POST /my-endpoint HTTP/1.1
Host: api.example.com:8767
Authorization: Bearer my-token-value
content-type: application/json
{
"name": "sample",
"time": "Wed, 21 Oct 2015 18:27:50 GMT"
}
GET /hello.txt HTTP/1.1
User-Agent: curl/7.64.1
Host: www.example.com
Accept-Language: en, mi
# from various places and https://www.rfc-editor.org/rfc/rfc9110.html#name-example-message-exchange

55
node_modules/shiki/samples/imba.sample generated vendored Normal file
View file

@ -0,0 +1,55 @@
global css body m:0 p:0 rd:lg bg:yellow1 of:hidden
tag value-picker
css w:100px h:40px pos:rel
d:hgrid ji:center ai:center
css .item h:100% pos:rel tween:styles 0.1s ease-out
def update e
data = options[e.x]
<self @touch.stop.fit(0,options.length - 1,1)=update>
for item in options
<div.item[$value:{item}] .sel=(item==data)>
tag stroke-picker < value-picker
css .item bg:black w:calc($value*1px) h:40% rd:sm
o:0.3 @hover:0.8 .sel:1
tag color-picker < value-picker
css .item js:stretch rdt:lg bg:$value mx:2px scale-y.sel:1.5
tag app-canvas
prop dpr = window.devicePixelRatio
prop state = {}
def draw e
let path = e.#path ||= new Path2D
let ctx = $canvas.getContext('2d')
path.lineTo(e.x * dpr,e.y * dpr)
ctx.lineWidth = state.stroke * dpr
ctx.strokeStyle = state.color
ctx.stroke(path)
def resized e
$canvas.width = offsetWidth * dpr
$canvas.height = offsetHeight * dpr
<self @resize=resized @touch.prevent.moved.fit(self)=draw>
<canvas$canvas[pos:abs w:100% h:100%]>
const strokes = [1,2,3,5,8,12]
const colors = ['#F59E0B','#10B981','#3B82F6','#8B5CF6']
const state = {stroke: 5, color: '#3B82F6'}
tag App
<self>
<div[ta:center pt:20 o:0.2 fs:xl]> 'draw here'
<app-canvas[pos:abs inset:0] state=state>
<div.tools[pos:abs b:0 w:100% d:hgrid ja:center]>
<stroke-picker options=strokes bind=state.stroke>
<color-picker options=colors bind=state.color>
imba.mount <App[pos:abs inset:0]>
# from https://imba.io
# run online at https://scrimba.com/scrim/cPPdD4Aq

10
node_modules/shiki/samples/java.sample generated vendored Normal file
View file

@ -0,0 +1,10 @@
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
// From https://introcs.cs.princeton.edu/java/11hello/HelloWorld.java.html

26
node_modules/shiki/samples/javascript.sample generated vendored Normal file
View file

@ -0,0 +1,26 @@
// posts will be populated at build time by getStaticProps()
function Blog({ posts }) {
return (
<ul>
{posts.map((post) => (
<li>{post.title}</li>
))}
</ul>
)
}
// This function gets called at build time on server-side.
export async function getStaticProps() {
const res = await fetch('https://.../posts')
const posts = await res.json()
return {
props: {
posts
}
}
}
export default Blog
// From https://nextjs.org/docs/basic-features/data-fetching

61
node_modules/shiki/samples/jison.sample generated vendored Normal file
View file

@ -0,0 +1,61 @@
/* description: Parses end executes mathematical expressions. */
/* lexical grammar */
%lex
%%
\s+ /* skip whitespace */
[0-9]+("."[0-9]+)?\b return 'NUMBER';
"*" return '*';
"/" return '/';
"-" return '-';
"+" return '+';
"^" return '^';
"(" return '(';
")" return ')';
"PI" return 'PI';
"E" return 'E';
<<EOF>> return 'EOF';
/lex
/* operator associations and precedence */
%left '+' '-'
%left '*' '/'
%left '^'
%left UMINUS
%start expressions
%% /* language grammar */
expressions
: e EOF
{print($1); return $1;}
;
e
: e '+' e
{$$ = $1+$3;}
| e '-' e
{$$ = $1-$3;}
| e '*' e
{$$ = $1*$3;}
| e '/' e
{$$ = $1/$3;}
| e '^' e
{$$ = Math.pow($1, $3);}
| '-' e %prec UMINUS
{$$ = -$2;}
| '(' e ')'
{$$ = $2;}
| NUMBER
{$$ = Number(yytext);}
| E
{$$ = Math.E;}
| PI
{$$ = Math.PI;}
;
/* From https://gerhobbelt.github.io/jison/docs/#specifying-a-language */

41
node_modules/shiki/samples/json5.sample generated vendored Normal file
View file

@ -0,0 +1,41 @@
// This file is written in JSON5 syntax, naturally, but npm needs a regular
// JSON file, so compile via `npm run build`. Be sure to keep both in sync!
{
name: 'json5',
version: '0.5.0',
description: 'JSON for the ES5 era.',
keywords: ['json', 'es5'],
author: 'Aseem Kishore <aseem.kishore@gmail.com>',
contributors: [
// TODO: Should we remove this section in favor of GitHub's list?
// https://github.com/aseemk/json5/contributors
'Max Nanasy <max.nanasy@gmail.com>',
'Andrew Eisenberg <andrew@eisenberg.as>',
'Jordan Tucker <jordanbtucker@gmail.com>',
],
main: 'lib/json5.js',
bin: 'lib/cli.js',
files: ["lib/"],
dependencies: {},
devDependencies: {
gulp: "^3.9.1",
'gulp-jshint': "^2.0.0",
jshint: "^2.9.1",
'jshint-stylish': "^2.1.0",
mocha: "^2.4.5"
},
scripts: {
build: 'node ./lib/cli.js -c package.json5',
test: 'mocha --ui exports --reporter spec',
// TODO: Would it be better to define these in a mocha.opts file?
},
homepage: 'http://json5.org/',
license: 'MIT',
repository: {
type: 'git',
url: 'https://github.com/aseemk/json5.git',
},
}
https://github.com/mrmlnc/vscode-json5/blob/master/syntaxes/json5.json

22
node_modules/shiki/samples/jssm.sample generated vendored Normal file
View file

@ -0,0 +1,22 @@
machine_name : "BGP";
machine_reference : "http://www.inetdaemon.com/tutorials/internet/ip/routing/bgp/operation/finite_state_model.shtml";
machine_version : 1.0.0;
machine_author : "John Haugeland <stonecypher@gmail.com>";
machine_license : MIT;
jssm_version : >= 5.0.0;
Idle -> [Idle Connect];
Connect -> [Idle Connect OpenSent Active];
Active -> [Idle Connect OpenSent Active];
OpenSent -> [Idle Active OpenConfirm];
OpenConfirm -> [Idle OpenSent OpenConfirm Established];
Established -> [Idle Established];
# from https://github.com/StoneCypher/jssm/blob/main/src/machines/linguist/bgp.fsl

149
node_modules/shiki/samples/kotlin.sample generated vendored Normal file
View file

@ -0,0 +1,149 @@
package com.example.kotlin
import java.util.Random as Rand
import android.support.v7.app.AppCompatActivity
import org.amshove.kluent.`should equal` as Type
fun main(@NonNull args: Array<String>) {
println("Hello Kotlin! ${/*test*/}")
val map = mutableMapOf("A" to "B")
thing.apply("random string here \n\t\r")
thing.let { test: -> }
val string = "${getThing()}"
}
val items = listOf("apple", "banana", "kiwifruit")
var x = 9
const val CONSTANT = 99
@get:Rule
val activityRule = ActivityTestRule(SplashActivity::class.java)
val oneMillion = 1_000_000
val creditCardNumber = 1234_5678_9012_3456L
val socialSecurityNumber = 999_99_9999L
val hexBytes = 0xFF_EC_DE_5E
val float = 0.043_331F
val bytes = 0b11010010_01101001_10010100_10010010
if(test == "") {
1 and 2 not 3
} else {
}
fun <T> foo() {
val x = Bar::class
val y = hello?.test
}
suspend fun <T, U> SequenceBuilder<Int>.yieldIfOdd(x: Int) {
if (x % 2 != 0) yield(x)
}
val function = fun(@Inject x: Int, y: Int, lamda: (A, B) -> Unit): Int {
test.test()
return x + y;
}
abstract fun onCreate(savedInstanceState: Bundle?)
fun isOdd(x: Int) = x % 2 != 0
fun isOdd(s: String) = s == "brillig" || s == "slithy" || s == "tove"
val numbers = listOf(1, 2, 3)
println(numbers.filter(::isOdd))
fun foo(node: Node?): String? {
val parent = node.getParent() ?: return null
}
interface Greetable {
fun greet()
}
open class Greeter: Greetable {
companion object {
private const val GREETING = "Hello, World!"
}
override fun greet() {
println(GREETING)
}
}
expect class Foo(bar: String) {
fun frob()
}
actual class Foo actual constructor(val bar: String) {
actual fun frob() {
println("Frobbing the $bar")
}
}
expect fun formatString(source: String, vararg args: Any): String
expect annotation class Test
actual fun formatString(source: String, vararg args: Any) = String.format(source, args)
actual typealias Test = org.junit.Test
sealed class Expr
data class Const(val number: Double) : Expr()
data class Sum(val e1: Expr, val e2: Expr) : Expr()
object NotANumber : Expr()
@file:JvmName("Foo")
private sealed class InjectedClass<T, U> @Inject constructor(
val test: Int = 50,
var anotherVar: String = "hello world"
) : SomeSuperClass(test, anotherVar) {
init {
//
}
constructor(param1: String, param2: Int): this(param1, param2) {
//
}
companion object {
//
}
}
annotation class Suspendable
val f = @Suspendable { Fiber.sleep(10) }
private data class Foo(
/**
* ```
* ($)
* ```
*/
val variables: Map<String, String>
)
data class Response(@SerializedName("param1") val param1: String,
@SerializedName("param2") val param2: String,
@SerializedName("param3") val param3: String) {
}
object DefaultListener : MouseAdapter() {
override fun mouseClicked(e: MouseEvent) { }
override fun mouseEntered(e: MouseEvent) { }
}
class Feature : Node("Title", "Content", "Description") {
}
class Outer {
inner class Inner {}
}
// From: https://github.com/nishtahir/language-kotlin/blob/master/snapshots/corpus.kt

7
node_modules/shiki/samples/kusto.sample generated vendored Normal file
View file

@ -0,0 +1,7 @@
let dt = datetime(2017-01-29 09:00:05);
print
v1=format_datetime(dt,'yy-MM-dd [HH:mm:ss]'),
v2=format_datetime(dt, 'yyyy-M-dd [H:mm:ss]'),
v3=format_datetime(dt, 'yy-MM-dd [hh:mm:ss tt]')
// From https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/

14
node_modules/shiki/samples/liquid.sample generated vendored Normal file
View file

@ -0,0 +1,14 @@
<h3>Recommended Products</h3>
<ul class="recommended_products">
{% assign recommended_products = product.metafields.my_fields.rec_products.value %}
{% for product in recommended_products %}
<li>
<a href="{{ product.url }}">
{{ product.featured_image | image_url: width: 400 | image_tag: loading: 'lazy' }}
{{product.title}}
</a>
</li>
{% endfor %}
</ul>
{%- comment -%} From https://www.codeshopify.com/blog_posts/related-products-with-product_list-sections-metafields {%- endcomment -%}

22
node_modules/shiki/samples/powerquery.sample generated vendored Normal file
View file

@ -0,0 +1,22 @@
// Transforms a table into markdown syntax
(Table as table) =>
let
Source = Table,
TableValues = Table.AddColumn(
Source, "Custom", each Text.Combine(Record.FieldValues(_), " | ")
),
HyphenLine = Text.Combine(
List.Transform(
Table.ColumnNames(Source), each Text.Repeat("-", Text.Length(_))
),
" | "
),
CombineList = List.Combine(
{{Text.Combine(Table.ColumnNames(Source), " | ")},
{HyphenLine}, TableValues[Custom]}
),
TransferToMarkdown = Text.Combine(CombineList, "#(lf)")
in
TransferToMarkdown
// From https://github.com/mogulargmbh/powerquerysnippets/blob/main/snippets/Table_ToMarkdown.pq

41
node_modules/shiki/samples/prisma.sample generated vendored Normal file
View file

@ -0,0 +1,41 @@
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
/// Post including an author and content.
model Post {
id Int @default(autoincrement()) @id
content String?
published Boolean @default(false)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
// Documentation for this model.
model User {
id Int @default(autoincrement()) @id
email String @unique
name String?
posts Post[]
specialName UserName
test Test
}
/// This is an enum specifying the UserName.
enum UserName {
Fred
Eric
}
// This is a test enum.
enum Test {
TestUno
TestDue
}
// taken from https://github.com/prisma/language-tools/blob/master/packages/vscode/testFixture/hover.prisma

45
node_modules/shiki/samples/proto.sample generated vendored Normal file
View file

@ -0,0 +1,45 @@
syntax = "proto3";
package mypackage.books.v1;
import "google/protobuf/empty.proto";
import "google/api/field_behavior.proto";
import "google/api/annotations.proto";
option go_package = "mypackage.books.v1/books";
// Book service
service BooksService {
// Get a book.
rpc GetBook(GetBookRequest) returns (Book) {
option (google.api.http) = {
get: "/resources/store/v1/{name=books/*}"
};
}
}
// The definition of a book resource.
message Book {
// The name of the book.
// Format: books/{book}.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// The display name of the book.
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
// The authors of the book.
repeated string authors = 3 [(google.api.field_behavior) = REQUIRED];
// The publisher of the book
string publisher = 4 [(google.api.field_behavior) = OPTIONAL];
}
// Request message for [play.me.resources.books.v1.BooksService.GetBook].
message GetBookRequest {
// The book name is the unique identifier across organisations.
// Format: books/{book}
string name = 1 [(google.api.field_behavior) = REQUIRED];
}
// From https://alis.build/guides/how-to-guides/make-your-first-request.html#book-repository-example

12
node_modules/shiki/samples/python.sample generated vendored Normal file
View file

@ -0,0 +1,12 @@
def fib(n): # write Fibonacci series up to n
"""Print a Fibonacci series up to n."""
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
print()
# Now call the function we just defined:
fib(2000)
# From https://docs.python.org/3/tutorial/controlflow.html#defining-functions

26
node_modules/shiki/samples/reg.sample generated vendored Normal file
View file

@ -0,0 +1,26 @@
Windows Registry Editor Version 5.00
; WARNING: before run replace PATH_TO_APP with correct value
; Example: C:\\Anaconda3
[HKEY_CLASSES_ROOT\Directory\shell\AnacondaJupyterNotebook]
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
@="&Jupyter Notebook There"
"Icon"="\"PATH_TO_APP\\Menu\\jupyter.ico""
[HKEY_CLASSES_ROOT\Directory\shell\AnacondaJupyterNotebook\command]
@="cmd /K pushd \"%1\" && \"PATH_TO_APP\\Scripts\\activate.bat\" && jupyter-notebook"
[HKEY_CLASSES_ROOT\Directory\Background\shell\AnacondaJupyterNotebook]
; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear
@="&Jupyter Notebook Here"
"Icon"="\"PATH_TO_APP\\Menu\\jupyter.ico\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\AnacondaJupyterNotebook\command]
@="cmd /K \"PATH_TO_APP\\Scripts\\activate.bat\" && jupyter-notebook"
; From https://github.com/NickVeld/win-registry-snippets/blob/main/AnacondaJupyterNotebookHere.reg

66
node_modules/shiki/samples/rel.sample generated vendored Normal file
View file

@ -0,0 +1,66 @@
module person
def ssn = 123-45-6789
module name
def first = "John"
def middle = "Q"
def last = "Public"
end
module birth
def city = "Pittsburg"
def state = "PA"
def country = "USA"
def date = parse_date["2000-01-01", "Y-m-d"]
end
end
module mymodule
def R = {1; 2}
ic {count[R] = 2}
end
@inline
module my_stats[R]
def my_minmax = (min[R], max[R])
def my_mean = mean[R]
def my_median = median[R]
end
@inline
module BipartiteGraph[M, N]
def node = M; N
def edge = M, N
end
@inline
module CycleGraph[N]
def node = N
def edge(a in N, b in N) =
sort[N](x, a)
and sort[N](y, b)
and y = x%count[N] + 1
from x, y
end
@inline
module GraphProperties[G]
def outdegree[v in G:node] = count[v1 : G:edge(v, v1)] <++ 0
def indegree[v in G:node] = count[v1 : G:edge(v1, v)] <++ 0
def edge_count = count[G:edge] <++ 0
end
def cg = CompleteGraph[range[1 ,5, 1]]
def cg_props = GraphProperties[cg]
def bg = BipartiteGraph[{1; 2}, {3; 4; 5}]
def bg_props = GraphProperties[bg]
def cycleg = CycleGraph[{"a"; "b"; "c"; "d" ; "e"}]
def cycleg_props = GraphProperties[cycleg]
module output
def complete_edge_count = cg_props:edge_count
def bipartite_edge_count = bg_props:edge_count
def cycle_edge_count = cycleg_props:edge_count
end
# From https://docs.relational.ai/rel/concepts/modules/

21
node_modules/shiki/samples/ruby.sample generated vendored Normal file
View file

@ -0,0 +1,21 @@
class LotteryTicket
NUMERIC_RANGE = 1..25
attr_reader :picks, :purchased
def initialize( *picks )
if picks.length != 3
raise ArgumentError, "three numbers must be picked"
elsif picks.uniq.length != 3
raise ArgumentError, "the three picks must be different numbers"
elsif picks.detect { |p| not NUMERIC_RANGE === p }
raise ArgumentError, "the three picks must be numbers between 1 and 25"
end
@picks = picks
@purchased = Time.now
end
end
# From https://poignant.guide/book/chapter-5.html

8
node_modules/shiki/samples/sparql.sample generated vendored Normal file
View file

@ -0,0 +1,8 @@
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name (COUNT(?friend) AS ?count)
WHERE {
?person foaf:name ?name .
?person foaf:knows ?friend .
} GROUP BY ?person ?name
# From https://www.w3.org/TR/sparql11-overview/#sparql11-query

30
node_modules/shiki/samples/stata.sample generated vendored Normal file
View file

@ -0,0 +1,30 @@
capture program drop exit_message
program exit_message
syntax, rc(int) progname(str) start_time(str) [CAPture]
local end_time "$S_TIME $S_DATE"
local time "Start: `start_time'" _n(1) "End: `end_time'"
di ""
if (`rc' == 0) {
di "End: $S_TIME $S_DATE"
local paux ran
local message "`progname' finished running" _n(2) "`time'"
local subject "`progname' `paux'"
}
else if ("`capture'" == "") {
di "WARNING: $S_TIME $S_DATE"
local paux ran with non-0 exit status
local message "`progname' ran but Stata gave error code r(`rc')" _n(2) "`time'"
local subject "`progname' `paux'"
}
else {
di "ERROR: $S_TIME $S_DATE"
local paux ran with errors
local message "`progname' stopped with error code r(`rc')" _n(2) "`time'"
local subject "`progname' `paux'"
}
di "`subject'"
di ""
di "`message'"
end
* From https://github.com/mcaceresb/stata-gtools/blob/fad519ef0454936d450802ac732728ba953957ac/src/test/gtools_tests.do

25
node_modules/shiki/samples/tasl.sample generated vendored Normal file
View file

@ -0,0 +1,25 @@
# This is a tasl schema!
namespace s http://schema.org/
# classes are like tables, except they
# can be arbitrary algebraic data types,
# not just columns of primitives.
class s:Person :: {
s:name -> string
s:email -> ? uri
s:spouse -> ? * s:Person
s:gender -> [
s:Male
s:Female
s:value <- string
]
}
# references are a primitive type that
# point to other classes in the schema,
# just like foreign keys.
class s:Book :: {
s:name -> string
s:isbn -> uri
s:author -> * s:Person
}

26
node_modules/shiki/samples/tsx.sample generated vendored Normal file
View file

@ -0,0 +1,26 @@
// posts will be populated at build time by getStaticProps()
function Blog({ posts }) {
return (
<ul>
{posts.map((post) => (
<li>{post.title}</li>
))}
</ul>
)
}
// This function gets called at build time on server-side.
export async function getStaticProps() {
const res = await fetch('https://.../posts')
const posts = await res.json()
return {
props: {
posts
}
}
}
export default Blog
// From https://nextjs.org/docs/basic-features/data-fetching

16
node_modules/shiki/samples/turtle.sample generated vendored Normal file
View file

@ -0,0 +1,16 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://example.org/alice#me> a foaf:Person .
<http://example.org/alice#me> foaf:name "Alice" .
<http://example.org/alice#me> foaf:mbox <mailto:alice@example.org> .
<http://example.org/alice#me> foaf:knows <http://example.org/bob#me> .
<http://example.org/bob#me> foaf:knows <http://example.org/alice#me> .
<http://example.org/bob#me> foaf:name "Bob" .
<http://example.org/alice#me> foaf:knows <http://example.org/charlie#me> .
<http://example.org/charlie#me> foaf:knows <http://example.org/alice#me> .
<http://example.org/charlie#me> foaf:name "Charlie" .
<http://example.org/alice#me> foaf:knows <http://example.org/snoopy> .
<http://example.org/snoopy> foaf:name "Snoopy"@en .
# From https://www.w3.org/TR/sparql11-overview/#Example

38
node_modules/shiki/samples/v.sample generated vendored Normal file
View file

@ -0,0 +1,38 @@
// This program displays the fibonacci sequence
import os
fn main() {
// Check for user input
if os.args.len != 2 {
println('usage: fibonacci [rank]')
return
}
// Parse first argument and cast it to int
stop := os.args[1].int()
// Can only calculate correctly until rank 92
if stop > 92 {
println('rank must be 92 or less')
return
}
// Three consecutive terms of the sequence
mut a := i64(0)
mut b := i64(0)
mut c := i64(1)
println(a + b + c)
for _ in 0 .. stop {
// Set a and b to the next term
a = b
b = c
// Compute the new term
c = a + b
// Print the new term
println(c)
}
}
// From https://github.com/vlang/v/blob/master/examples/fibonacci.v

19
node_modules/shiki/samples/wgsl.sample generated vendored Normal file
View file

@ -0,0 +1,19 @@
struct CoolMaterial {
color: vec4<f32>,
};
@group(1) @binding(0)
var<uniform> material: CoolMaterial;
@group(1) @binding(1)
var color_texture: texture_2d<f32>;
@group(1) @binding(2)
var color_sampler: sampler;
@fragment
fn fragment(
#import bevy_pbr::mesh_vertex_output
) -> @location(0) vec4<f32> {
return material.color * textureSample(color_texture, color_sampler, uv);
}
// From https://bevyengine.org/news/bevy-0-8/

9
node_modules/shiki/samples/wolfram.sample generated vendored Normal file
View file

@ -0,0 +1,9 @@
iStochasticityAssumptions [sm_List] :=
SquareMatrixQ[sm] && Element[DeleteDuplicates[Flatten[sm]], Reals] &&
Apply [And, Map[#>=0&, sm, {2}], {0, 1}] && Apply [And, Thread[Total[sm, {2}] == 1]]
iStochasticityAssumptions[sm_SparseArray] := SquareMatrixQ[sm] &&
Apply[And, Thread[ DeleteDuplicates [ sm["NonzeroValues"] ~Join~ {sm["Background"]} ] >= 0 ] ] &&
Apply[And, Thread [Total [sm, {2}] = 1]]
(* https://github.com/WolframResearch/vscode-wolfram/blob/master/docs/highlighting.png *)

44
node_modules/shiki/samples/zenscript.sample generated vendored Normal file
View file

@ -0,0 +1,44 @@
import crafttweaker.api.BracketHandlers;
val air = <item:minecraft:air>;
val diamond = <item:minecraft:diamond>;
var woodTypes = ["oak","spruce","birch","jungle","acacia","dark_oak"];
for name in woodTypes {
val thing = BracketHandlers.getItem("minecraft:" + name + "_planks");
craftingTable.addShaped(name + "_diamond", diamond, [[air, thing], [thing, air]]);
}
function checkLeapYear(year as int) as bool {
if(year % 4 == 0) {
if(year % 100 == 0) {
if(year % 400 == 0) {
return true;
} else {
return false;
}
} else {
return true;
}
} else {
return false;
}
}
print("Is 2000 a leap year: " ~ checkLeapYear(2000));
print("Is 2004 a leap year: " ~ checkLeapYear(2004));
print("Is 2100 a leap year: " ~ checkLeapYear(2100));
print("Is 2012 a leap year: " ~ checkLeapYear(2012));
//Note: this is a cleaner way
function checkLeapYear2(year as int) as bool {
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}
print("Is 2000 a leap year (2nd function): " ~ checkLeapYear2(2000));
print("Is 2004 a leap year (2nd function): " ~ checkLeapYear2(2004));
print("Is 2100 a leap year (2nd function): " ~ checkLeapYear2(2100));
print("Is 2012 a leap year (2nd function): " ~ checkLeapYear2(2012));
# From https://github.com/CraftTweaker/CraftTweaker-Examples