Vitepress
This commit is contained in:
21
node_modules/shiki/samples/abap.sample
generated
vendored
Normal file
21
node_modules/shiki/samples/abap.sample
generated
vendored
Normal 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
27
node_modules/shiki/samples/actionscript-3.sample
generated
vendored
Normal 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
|
||||
22
node_modules/shiki/samples/ada.sample
generated
vendored
Normal file
22
node_modules/shiki/samples/ada.sample
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
with
|
||||
Ada.Text_IO,
|
||||
Ada.Integer_Text_IO;
|
||||
use Ada;
|
||||
|
||||
procedure fizz_buzz is
|
||||
begin
|
||||
for i in 1..100 loop
|
||||
if i mod 15 = 0 then
|
||||
Text_IO.Put_Line("fizz buzz");
|
||||
elsif i mod 5 = 0 then
|
||||
Text_IO.Put_Line("buzz");
|
||||
elsif i mod 3 = 0 then
|
||||
Text_IO.Put_Line("fizz");
|
||||
else
|
||||
Integer_Text_IO.put(i, Width => 0);
|
||||
Text_IO.New_Line;
|
||||
end if;
|
||||
end loop;
|
||||
end fizz_buzz;
|
||||
|
||||
-- From https://github.com/kylelk/ada-examples/blob/master/fizz_buzz.adb
|
||||
39
node_modules/shiki/samples/apache.sample
generated
vendored
Normal file
39
node_modules/shiki/samples/apache.sample
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# Apache httpd v2.4 minimal configuration
|
||||
# see https://wiki.apache.org/httpd/Minimal_Config for documentation
|
||||
|
||||
ServerRoot ${GITPOD_REPO_ROOT}
|
||||
|
||||
PidFile ${APACHE_PID_FILE}
|
||||
User ${APACHE_RUN_USER}
|
||||
Group ${APACHE_RUN_GROUP}
|
||||
|
||||
# Modules as installed/activated via apt-get
|
||||
IncludeOptional /etc/apache2/mods-enabled/*.load
|
||||
IncludeOptional /etc/apache2/mods-enabled/*.conf
|
||||
|
||||
# Configure hostname and port for server
|
||||
ServerName ${APACHE_SERVER_NAME}
|
||||
Listen *:8080
|
||||
|
||||
# Configure Logging
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log common
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Never change this block
|
||||
<Directory />
|
||||
AllowOverride None
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
# Direcrory and files to be served
|
||||
DirectoryIndex index.html
|
||||
DocumentRoot "${GITPOD_REPO_ROOT}/www"
|
||||
<Directory "${GITPOD_REPO_ROOT}/www">
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
# Include conf installed via apt-get
|
||||
IncludeOptional /etc/apache2/conf-enabled/*.conf
|
||||
|
||||
# https://github.com/gitpod-io/apache-example/blob/master/apache/apache.conf
|
||||
19
node_modules/shiki/samples/apex.sample
generated
vendored
Normal file
19
node_modules/shiki/samples/apex.sample
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
public class EmailManager {
|
||||
|
||||
public static void sendMail(String address, String subject, String body) {
|
||||
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
|
||||
String[] toAddresses = new String[] {address};
|
||||
mail.setToAddresses(toAddresses);
|
||||
mail.setSubject(subject);
|
||||
mail.setPlainTextBody(body);
|
||||
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String address = 'YOUR_EMAIL_ADDRESS';
|
||||
String subject = 'Speaker Confirmation';
|
||||
String body = 'Thank you for speaking at the conference.';
|
||||
EmailManager.sendMail(address, subject, body);
|
||||
|
||||
// From http://ccoenraets.github.io/salesforce-developer-workshop/Creating-an-Apex-Class.html
|
||||
37
node_modules/shiki/samples/apl.sample
generated
vendored
Normal file
37
node_modules/shiki/samples/apl.sample
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
CND ← {
|
||||
X ← ⍵
|
||||
a ← 0.31938153 ¯0.356563782 1.781477937 ¯1.821255978 1.330274429
|
||||
|
||||
l ← |X
|
||||
k ← ÷1+0.2316419×l
|
||||
w ← 1 - (÷((2×(○1))*0.5)) × (*-(l×l)÷2) × (a +.× (k*⍳5))
|
||||
|
||||
((|0⌊×X)×(1-w))+(1-|0⌊×X)×w
|
||||
}
|
||||
|
||||
⍝ S - current price
|
||||
⍝ X - strike price
|
||||
⍝ T - expiry in years
|
||||
⍝ r - riskless interest rate
|
||||
⍝ v - volatility
|
||||
|
||||
S ← 60
|
||||
X ← 65
|
||||
T ← 1
|
||||
r ← 0.1
|
||||
v ← 0.2
|
||||
|
||||
d1 ← { ((⍟S÷X)+(r+(v*2)÷2)×⍵)÷(v×⍵*0.5) }
|
||||
d2 ← { (d1 ⍵) -v×⍵*0.5 }
|
||||
|
||||
⍝ Call price
|
||||
callPrice ← { (S×CND(d1 ⍵))-(X×*-r×⍵)×CND(d2 ⍵) }
|
||||
|
||||
avg ← { (+/⍵) ÷ ⊃⍴ ⍵ }
|
||||
|
||||
⎕←avg callPrice¨ (⍳ 100000) ÷ 10000
|
||||
|
||||
⍝ Put price (not tested)
|
||||
⍝ putPrice ← { (X×*-r×⍵)×CND(-d2 ⍵)-S×CND(-d1 ⍵) }
|
||||
|
||||
⍝ From https://github.com/melsman/apltail/blob/master/tests/blacksch.apl
|
||||
19
node_modules/shiki/samples/applescript.sample
generated
vendored
Normal file
19
node_modules/shiki/samples/applescript.sample
generated
vendored
Normal 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
29
node_modules/shiki/samples/ara.sample
generated
vendored
Normal 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
18
node_modules/shiki/samples/asm.sample
generated
vendored
Normal 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
|
||||
28
node_modules/shiki/samples/astro.sample
generated
vendored
Normal file
28
node_modules/shiki/samples/astro.sample
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
// Your component script here!
|
||||
import Banner from '../components/Banner.astro';
|
||||
import ReactPokemonComponent from '../components/ReactPokemonComponent.jsx';
|
||||
const myFavoritePokemon = [/* ... */];
|
||||
const { title } = Astro.props;
|
||||
---
|
||||
<!-- HTML comments supported! -->
|
||||
{/* JS comment syntax is also valid! */}
|
||||
|
||||
<Banner />
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
<!-- Use props and other variables from the component script: -->
|
||||
<p>{title}</p>
|
||||
|
||||
<!-- Include other UI framework components with a `client:` directive to hydrate: -->
|
||||
<ReactPokemonComponent client:visible />
|
||||
|
||||
<!-- Mix HTML with JavaScript expressions, similar to JSX: -->
|
||||
<ul>
|
||||
{myFavoritePokemon.map((data) => <li>{data.name}</li>)}
|
||||
</ul>
|
||||
|
||||
<!-- Use a template directive to build class names from multiple strings or even objects! -->
|
||||
<p class:list={["add", "dynamic", {classNames: true}]} />
|
||||
|
||||
<!-- From https://docs.astro.build/en/core-concepts/astro-components/ -->
|
||||
25
node_modules/shiki/samples/awk.sample
generated
vendored
Normal file
25
node_modules/shiki/samples/awk.sample
generated
vendored
Normal 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
32
node_modules/shiki/samples/ballerina.sample
generated
vendored
Normal 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
|
||||
28
node_modules/shiki/samples/bash.sample
generated
vendored
Normal file
28
node_modules/shiki/samples/bash.sample
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# weather.sh
|
||||
# Copyright 2018 computer-geek64. All rights reserved.
|
||||
|
||||
program=Weather
|
||||
version=1.1
|
||||
year=2018
|
||||
developer=computer-geek64
|
||||
|
||||
case $1 in
|
||||
-h | --help)
|
||||
echo "$program $version"
|
||||
echo "Copyright $year $developer. All rights reserved."
|
||||
echo
|
||||
echo "Usage: weather [options]"
|
||||
echo "Option Long Option Description"
|
||||
echo "-h --help Show the help screen"
|
||||
echo "-l [location] --location [location] Specifies the location"
|
||||
;;
|
||||
-l | --location)
|
||||
curl https://wttr.in/$2
|
||||
;;
|
||||
*)
|
||||
curl https://wttr.in
|
||||
;;
|
||||
esac
|
||||
|
||||
# From https://github.com/ruanyf/simple-bash-scripts/blob/master/scripts/weather.sh
|
||||
21
node_modules/shiki/samples/bat.sample
generated
vendored
Normal file
21
node_modules/shiki/samples/bat.sample
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
rem
|
||||
rem Alternate form of if-elseif-else structure with goto for else
|
||||
rem case. That way, you can group code together in a "more logical"
|
||||
rem or "more natural" manner.
|
||||
rem
|
||||
|
||||
if .%1 == .1 goto 1
|
||||
if .%1 == .2 goto 2
|
||||
goto else
|
||||
:1
|
||||
echo You selected 1
|
||||
goto endif
|
||||
:2
|
||||
echo You selected 2
|
||||
goto endif
|
||||
:else
|
||||
echo else (neither 1 nor 2)
|
||||
goto endif
|
||||
:endif
|
||||
|
||||
:: From https://github.com/Archive-projects/Batch-File-examples/blob/master/files/tf5.bat
|
||||
9
node_modules/shiki/samples/beancount.sample
generated
vendored
Normal file
9
node_modules/shiki/samples/beancount.sample
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
2012-11-03 * "Transfer to pay credit card"
|
||||
Assets:MyBank:Checking -400.00 USD
|
||||
Liabilities:CreditCard 400.00 USD
|
||||
|
||||
2012-11-03 * "Transfer to account in Canada"
|
||||
Assets:MyBank:Checking -400.00 USD @ 1.09 CAD
|
||||
Assets:FR:SocGen:Checking 436.01 CAD
|
||||
|
||||
; https://beancount.github.io/docs/beancount_language_syntax.html#costs-and-prices
|
||||
60
node_modules/shiki/samples/berry.sample
generated
vendored
Normal file
60
node_modules/shiki/samples/berry.sample
generated
vendored
Normal 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
|
||||
28
node_modules/shiki/samples/bibtex.sample
generated
vendored
Normal file
28
node_modules/shiki/samples/bibtex.sample
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
% This file was created with JabRef 2.10.
|
||||
% Encoding: UTF8
|
||||
|
||||
@Inproceedings{NN2006-Supporting,
|
||||
Title = {{Supporting...}},
|
||||
Author = {N. N. and X. X.},
|
||||
Year = {2006},
|
||||
Month = {8,},
|
||||
|
||||
Owner = {xxx},
|
||||
Timestamp = {2010.01.01}
|
||||
}
|
||||
|
||||
|
||||
@Book{NN1997-Entwurf,
|
||||
Title = {Entwurf...},
|
||||
Publisher = {Org},
|
||||
Year = {1997},
|
||||
Month = oct,
|
||||
|
||||
Owner = {xx},
|
||||
Timestamp = {2006.06.12},
|
||||
}
|
||||
|
||||
|
||||
@comment{jabref-meta: fileDirectory:Folder;}
|
||||
|
||||
% From https://github.com/JabRef/jabref/blob/main/src/test/resources/testbib/bug1283.bib
|
||||
47
node_modules/shiki/samples/bicep.sample
generated
vendored
Normal file
47
node_modules/shiki/samples/bicep.sample
generated
vendored
Normal 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
47
node_modules/shiki/samples/blade.sample
generated
vendored
Normal 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
52
node_modules/shiki/samples/c.sample
generated
vendored
Normal 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
19
node_modules/shiki/samples/cadence.sample
generated
vendored
Normal 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
53
node_modules/shiki/samples/clarity.sample
generated
vendored
Normal 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/clj.sample
generated
vendored
Normal file
14
node_modules/shiki/samples/clj.sample
generated
vendored
Normal 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
|
||||
14
node_modules/shiki/samples/clojure.sample
generated
vendored
Normal file
14
node_modules/shiki/samples/clojure.sample
generated
vendored
Normal 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
36
node_modules/shiki/samples/cmake.sample
generated
vendored
Normal 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
|
||||
94
node_modules/shiki/samples/cobol.sample
generated
vendored
Normal file
94
node_modules/shiki/samples/cobol.sample
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
******************************************************************
|
||||
* Author: Bryan Flood
|
||||
* Date: 25/10/2018
|
||||
* Purpose: Compute Fibonacci Numbers
|
||||
* Tectonics: cobc
|
||||
******************************************************************
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. FIB.
|
||||
DATA DIVISION.
|
||||
FILE SECTION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 N0 BINARY-C-LONG VALUE 0.
|
||||
01 N1 BINARY-C-LONG VALUE 1.
|
||||
01 SWAP BINARY-C-LONG VALUE 1.
|
||||
01 RESULT PIC Z(20)9.
|
||||
01 I BINARY-C-LONG VALUE 0.
|
||||
01 I-MAX BINARY-C-LONG VALUE 0.
|
||||
01 LARGEST-N BINARY-C-LONG VALUE 92.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
*> THIS IS WHERE THE LABELS GET CALLED
|
||||
PERFORM MAIN
|
||||
PERFORM ENDFIB
|
||||
GOBACK.
|
||||
|
||||
*> THIS ACCEPTS INPUT AND DETERMINES THE OUTPUT USING A EVAL STMT
|
||||
MAIN.
|
||||
DISPLAY "ENTER N TO GENERATE THE FIBONACCI SEQUENCE"
|
||||
ACCEPT I-MAX.
|
||||
|
||||
EVALUATE TRUE
|
||||
WHEN I-MAX > LARGEST-N
|
||||
PERFORM INVALIDN
|
||||
|
||||
WHEN I-MAX > 2
|
||||
PERFORM CASEGREATERTHAN2
|
||||
|
||||
WHEN I-MAX = 2
|
||||
PERFORM CASE2
|
||||
|
||||
WHEN I-MAX = 1
|
||||
PERFORM CASE1
|
||||
|
||||
WHEN I-MAX = 0
|
||||
PERFORM CASE0
|
||||
|
||||
WHEN OTHER
|
||||
PERFORM INVALIDN
|
||||
|
||||
END-EVALUATE.
|
||||
|
||||
STOP RUN.
|
||||
|
||||
|
||||
|
||||
*> THE CASE FOR WHEN N = 0
|
||||
CASE0.
|
||||
MOVE N0 TO RESULT.
|
||||
DISPLAY RESULT.
|
||||
|
||||
*> THE CASE FOR WHEN N = 1
|
||||
CASE1.
|
||||
PERFORM CASE0
|
||||
MOVE N1 TO RESULT.
|
||||
DISPLAY RESULT.
|
||||
|
||||
*> THE CASE FOR WHEN N = 2
|
||||
CASE2.
|
||||
PERFORM CASE1
|
||||
MOVE N1 TO RESULT.
|
||||
DISPLAY RESULT.
|
||||
|
||||
*> THE CASE FOR WHEN N > 2
|
||||
CASEGREATERTHAN2.
|
||||
PERFORM CASE1
|
||||
PERFORM VARYING I FROM 1 BY 1 UNTIL I = I-MAX
|
||||
ADD N0 TO N1 GIVING SWAP
|
||||
MOVE N1 TO N0
|
||||
MOVE SWAP TO N1
|
||||
MOVE SWAP TO RESULT
|
||||
DISPLAY RESULT
|
||||
END-PERFORM.
|
||||
|
||||
*> PROVIDE ERROR FOR INVALID INPUT
|
||||
INVALIDN.
|
||||
DISPLAY 'INVALID N VALUE. THE PROGRAM WILL NOW END'.
|
||||
|
||||
*> END THE PROGRAM WITH A MESSAGE
|
||||
ENDFIB.
|
||||
DISPLAY "THE PROGRAM HAS COMPLETED AND WILL NOW END".
|
||||
|
||||
END PROGRAM FIB.
|
||||
|
||||
*> From https://github.com/KnowledgePending/COBOL-Fibonacci-Sequence/blob/master/fib.cbl
|
||||
102
node_modules/shiki/samples/codeql.sample
generated
vendored
Normal file
102
node_modules/shiki/samples/codeql.sample
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @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
30
node_modules/shiki/samples/coffee.sample
generated
vendored
Normal 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
21
node_modules/shiki/samples/cpp.sample
generated
vendored
Normal 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
43
node_modules/shiki/samples/crystal.sample
generated
vendored
Normal 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
33
node_modules/shiki/samples/csharp.sample
generated
vendored
Normal 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
|
||||
46
node_modules/shiki/samples/css.sample
generated
vendored
Normal file
46
node_modules/shiki/samples/css.sample
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
html {
|
||||
margin: 0;
|
||||
background: black;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: inherit;
|
||||
}
|
||||
|
||||
/* the three main rows going down the page */
|
||||
|
||||
body > div {
|
||||
height: 25%;
|
||||
}
|
||||
|
||||
.thumb {
|
||||
float: left;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.blowup {
|
||||
display: block;
|
||||
position: absolute;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
.darken {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
/* From https://github.com/mdn/css-examples/blob/main/object-fit-gallery/style.css */
|
||||
108
node_modules/shiki/samples/cue.sample
generated
vendored
Normal file
108
node_modules/shiki/samples/cue.sample
generated
vendored
Normal 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
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
21
node_modules/shiki/samples/cypher.sample
generated
vendored
Normal file
21
node_modules/shiki/samples/cypher.sample
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
UNWIND [
|
||||
{ title: "Cypher Basics I",
|
||||
created: datetime("2019-06-01T18:40:32.142+0100"),
|
||||
datePublished: date("2019-06-01"),
|
||||
readingTime: {minutes: 2, seconds: 15} },
|
||||
{ title: "Cypher Basics II",
|
||||
created: datetime("2019-06-02T10:23:32.122+0100"),
|
||||
datePublished: date("2019-06-02"),
|
||||
readingTime: {minutes: 2, seconds: 30} },
|
||||
{ title: "Dates, Datetimes, and Durations in Neo4j",
|
||||
created: datetime(),
|
||||
datePublished: date(),
|
||||
readingTime: {minutes: 3, seconds: 30} }
|
||||
] AS articleProperties
|
||||
|
||||
CREATE (article:Article {title: articleProperties.title})
|
||||
SET article.created = articleProperties.created,
|
||||
article.datePublished = articleProperties.datePublished,
|
||||
article.readingTime = duration(articleProperties.readingTime)
|
||||
|
||||
// https://neo4j.com/developer/cypher/dates-datetimes-durations/
|
||||
18
node_modules/shiki/samples/d.sample
generated
vendored
Normal file
18
node_modules/shiki/samples/d.sample
generated
vendored
Normal 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
32
node_modules/shiki/samples/dart.sample
generated
vendored
Normal 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
19
node_modules/shiki/samples/dax.sample
generated
vendored
Normal 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
28
node_modules/shiki/samples/diff.sample
generated
vendored
Normal 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
77
node_modules/shiki/samples/dm.sample
generated
vendored
Normal 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
19
node_modules/shiki/samples/docker.sample
generated
vendored
Normal 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/
|
||||
24
node_modules/shiki/samples/dream-maker.sample
generated
vendored
Normal file
24
node_modules/shiki/samples/dream-maker.sample
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/mob/Login()
|
||||
var/count = 0
|
||||
|
||||
world << "Let's count until infinity!"
|
||||
|
||||
// Infinite loop
|
||||
while (TRUE)
|
||||
count += 1
|
||||
|
||||
if (count == 3)
|
||||
world << "three"
|
||||
|
||||
// Skip the rest of this iteration
|
||||
continue
|
||||
|
||||
world << "#[count]"
|
||||
|
||||
if (count == 5)
|
||||
world << "OK, that's enough"
|
||||
|
||||
// Exit this loop
|
||||
break
|
||||
|
||||
// From https://spacestation13.github.io/DMByExample/flow/loops.html
|
||||
26
node_modules/shiki/samples/elixir.sample
generated
vendored
Normal file
26
node_modules/shiki/samples/elixir.sample
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# [] can be used, first match returned
|
||||
1 = [a: 1, b: 2, a: 3][:a]
|
||||
|
||||
# [] missing value is nil
|
||||
nil = [a: 1, b: 2, a: 3][:c]
|
||||
|
||||
# Keyword get also works
|
||||
1 = Keyword.get([a: 1, b: 2, a: 3], :a)
|
||||
|
||||
# missing value is nil
|
||||
nil = Keyword.get([a: 1, b: 2, a: 3], :c)
|
||||
|
||||
# an optional default value can be specified
|
||||
# for missing keys
|
||||
"missing" = Keyword.get([a: 1, b: 2, a: 3], :c, "missing")
|
||||
|
||||
# Keyword.take returns a list of matching pairs
|
||||
[a: 1, a: 3] = Keyword.take([a: 1, b: 2, a: 3], [:a])
|
||||
|
||||
[] = Keyword.take([a: 1, b: 2, a: 3], [:c])
|
||||
|
||||
# dot syntax does NOT work
|
||||
# results in compile error
|
||||
[a: 1, b: 2, a: 3].a
|
||||
|
||||
# From https://elixir-examples.github.io/single-page
|
||||
66
node_modules/shiki/samples/elm.sample
generated
vendored
Normal file
66
node_modules/shiki/samples/elm.sample
generated
vendored
Normal 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
69
node_modules/shiki/samples/erb.sample
generated
vendored
Normal 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
50
node_modules/shiki/samples/erlang.sample
generated
vendored
Normal 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
13
node_modules/shiki/samples/fish.sample
generated
vendored
Normal 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
13
node_modules/shiki/samples/fsharp.sample
generated
vendored
Normal 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
47
node_modules/shiki/samples/fsl.sample
generated
vendored
Normal 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
95
node_modules/shiki/samples/gdresource.sample
generated
vendored
Normal 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
57
node_modules/shiki/samples/gdscript.sample
generated
vendored
Normal 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
97
node_modules/shiki/samples/gdshader.sample
generated
vendored
Normal 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
|
||||
11
node_modules/shiki/samples/gherkin.sample
generated
vendored
Normal file
11
node_modules/shiki/samples/gherkin.sample
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
Scenario: Eat 5 out of 12
|
||||
Given there are 12 cucumbers
|
||||
When I eat 5 cucumbers
|
||||
Then I should have 7 cucumbers
|
||||
|
||||
Scenario: Eat 5 out of 20
|
||||
Given there are 20 cucumbers
|
||||
When I eat 5 cucumbers
|
||||
Then I should have 15 cucumbers
|
||||
|
||||
# From https://gist.github.com/dogoku/0c024c55ec124355f01472abc70550f5
|
||||
18
node_modules/shiki/samples/gjs.sample
generated
vendored
Normal file
18
node_modules/shiki/samples/gjs.sample
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import { modifier } from 'ember-modifier';
|
||||
|
||||
const plusOne = helper(([num]) => num + 1);
|
||||
|
||||
const setScrollPosition = modifier((element, [position]) => {
|
||||
element.scrollTop = position
|
||||
});
|
||||
|
||||
<template>
|
||||
<div class="scroll-container" {{setScrollPosition @scrollPos}}>
|
||||
{{#each @items as |item index|}}
|
||||
Item #{{plusOne index}}: {{item}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
# From https://github.com/ember-template-imports/ember-template-imports
|
||||
86
node_modules/shiki/samples/glsl.sample
generated
vendored
Normal file
86
node_modules/shiki/samples/glsl.sample
generated
vendored
Normal 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
|
||||
20
node_modules/shiki/samples/gnuplot.sample
generated
vendored
Normal file
20
node_modules/shiki/samples/gnuplot.sample
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
set title 'Hello, world' # plot title
|
||||
set xlabel 'Time' # x-axis label
|
||||
set ylabel 'Distance' # y-axis label
|
||||
|
||||
# labels
|
||||
set label "boiling point" at 10, 212
|
||||
|
||||
# key/legend
|
||||
set key top right
|
||||
set key box
|
||||
set key left bottom
|
||||
set key bmargin
|
||||
set key 0.01,100
|
||||
|
||||
set nokey # no key
|
||||
|
||||
# arrow
|
||||
set arrow from 1,1 to 5,10
|
||||
|
||||
# From https://alvinalexander.com/technology/gnuplot-charts-graphs-examples/
|
||||
18
node_modules/shiki/samples/go.sample
generated
vendored
Normal file
18
node_modules/shiki/samples/go.sample
generated
vendored
Normal 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/graphql.sample
generated
vendored
Normal file
15
node_modules/shiki/samples/graphql.sample
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
query($number_of_repos:Int!) {
|
||||
viewer {
|
||||
name
|
||||
repositories(last: $number_of_repos) {
|
||||
nodes {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
variables {
|
||||
"number_of_repos": 3
|
||||
}
|
||||
|
||||
# From https://docs.github.com/en/graphql/guides/forming-calls-with-graphql
|
||||
18
node_modules/shiki/samples/groovy.sample
generated
vendored
Normal file
18
node_modules/shiki/samples/groovy.sample
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import org.mortbay.jetty.Server
|
||||
import org.mortbay.jetty.servlet.*
|
||||
import groovy.servlet.*
|
||||
|
||||
@Grab(group='org.mortbay.jetty', module='jetty-embedded', version='6.1.14')
|
||||
def startJetty() {
|
||||
def jetty = new Server(9090)
|
||||
def context = new Context(jetty, '/', Context.SESSIONS)
|
||||
context.setWelcomeFiles(["webserverIndex.groovy"] as String[])
|
||||
context.resourceBase = '.'
|
||||
context.addServlet(GroovyServlet, '*.groovy')
|
||||
jetty.start()
|
||||
}
|
||||
|
||||
println "Starting Jetty on port 9090, press Ctrl+C to stop."
|
||||
startJetty()
|
||||
|
||||
// From https://gist.github.com/saltnlight5/3756240
|
||||
7
node_modules/shiki/samples/gts.sample
generated
vendored
Normal file
7
node_modules/shiki/samples/gts.sample
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { TemplateOnlyComponent } from '@glimmer/component';
|
||||
|
||||
const Greet: TemplateOnlyComponent<{ name: string }> = <template>
|
||||
<p>Hello, {{@name}}!</p>
|
||||
</template>
|
||||
|
||||
# From https://rfcs.emberjs.com/id/0779-first-class-component-templates
|
||||
23
node_modules/shiki/samples/hack.sample
generated
vendored
Normal file
23
node_modules/shiki/samples/hack.sample
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<<__EntryPoint>>
|
||||
async function my_example(): Awaitable<void> {
|
||||
$user_ids = vec[1, 2, 3];
|
||||
|
||||
// Initiate all the database requests together,
|
||||
// so we spend less time waiting.
|
||||
$user_names = await Vec\map_async(
|
||||
$user_ids,
|
||||
async ($id) ==> await fetch_user_name($id),
|
||||
);
|
||||
// Execution continues after requests complete.
|
||||
|
||||
echo Str\join($user_names, ", ");
|
||||
}
|
||||
|
||||
async function fetch_user_name(
|
||||
int $_,
|
||||
): Awaitable<string> {
|
||||
// This could be a database request.
|
||||
return "";
|
||||
}
|
||||
|
||||
// From hacklang.org
|
||||
40
node_modules/shiki/samples/haml.sample
generated
vendored
Normal file
40
node_modules/shiki/samples/haml.sample
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
!!! 5
|
||||
%html
|
||||
%head
|
||||
%title Example HAML
|
||||
/[if IE]
|
||||
%link{ :rel => "stylesheet", :href => "/css/ie.css" }
|
||||
%body
|
||||
#container
|
||||
%header
|
||||
%h1 Our Awesome HTML5 Template
|
||||
#main
|
||||
Did we mention this was awesome?
|
||||
|
||||
/ Only this line will be wrapped in a comment
|
||||
%blockquote
|
||||
%p Roads? Where we're going we don't need roads
|
||||
|
||||
/
|
||||
Now the whole block will be commented out
|
||||
%blockquote
|
||||
%p Roads? Where we're going we don't need roads
|
||||
|
||||
%p The line below won't appear in the HTML
|
||||
-# The rest of this line is a comment
|
||||
%p The line above won't appear in the HTML, nor will the lines underneath
|
||||
-#
|
||||
None of this text will appear in our
|
||||
rendered output
|
||||
|
||||
%p= Time.now
|
||||
|
||||
%footer
|
||||
%address
|
||||
.hcard
|
||||
.fn Ian Oxley
|
||||
.adr
|
||||
.locality Newcastle-upon-Tyne
|
||||
.country-name England
|
||||
|
||||
/ From https://gist.github.com/ianoxley/1147666
|
||||
17
node_modules/shiki/samples/handlebars.sample
generated
vendored
Normal file
17
node_modules/shiki/samples/handlebars.sample
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="entry">
|
||||
<h1>{{title}}</h1>
|
||||
{{#with story}}
|
||||
<div class="intro">{{{intro}}}</div>
|
||||
<div class="body">{{{body}}}</div>
|
||||
{{/with}}
|
||||
</div>
|
||||
<div class="comments">
|
||||
{{#each comments}}
|
||||
<div class="comment">
|
||||
<h2>{{subject}}</h2>
|
||||
{{{body}}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
{{! From https://handlebarsjs.com/guide/block-helpers.html#the-with-helper }}
|
||||
23
node_modules/shiki/samples/haskell.sample
generated
vendored
Normal file
23
node_modules/shiki/samples/haskell.sample
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeFamilies #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
|
||||
import Yesod
|
||||
|
||||
data WebApp = WebApp
|
||||
|
||||
instance Yesod WebApp
|
||||
|
||||
mkYesod "WebApp" [parseRoutes|
|
||||
/ HomeR GET
|
||||
|]
|
||||
|
||||
getHomeR = defaultLayout [whamlet|
|
||||
<div>Hello, world!
|
||||
|]
|
||||
|
||||
main = warpEnv WebApp
|
||||
|
||||
{-# From https://www.schoolofhaskell.com/user/eriks/Simple%20examples }
|
||||
15
node_modules/shiki/samples/hcl.sample
generated
vendored
Normal file
15
node_modules/shiki/samples/hcl.sample
generated
vendored
Normal 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
|
||||
25
node_modules/shiki/samples/hjson.sample
generated
vendored
Normal file
25
node_modules/shiki/samples/hjson.sample
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
// use #, // or /**/ comments,
|
||||
// omit quotes for keys
|
||||
key: 1
|
||||
// omit quotes for strings
|
||||
contains: everything on this line
|
||||
// omit commas at the end of a line
|
||||
cool: {
|
||||
foo: 1
|
||||
bar: 2
|
||||
}
|
||||
// allow trailing commas
|
||||
list: [
|
||||
1,
|
||||
2,
|
||||
]
|
||||
// and use multiline strings
|
||||
realist:
|
||||
'''
|
||||
My half empty glass,
|
||||
I will fill your empty half.
|
||||
Now you are half full.
|
||||
'''
|
||||
// From: https://hjson.github.io/
|
||||
}
|
||||
20
node_modules/shiki/samples/hlsl.sample
generated
vendored
Normal file
20
node_modules/shiki/samples/hlsl.sample
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Diffuse : COLOR0;
|
||||
float2 TextureUV : TEXCOORD0;
|
||||
};
|
||||
|
||||
VS_OUTPUT RenderSceneVS( float4 vPos : POSITION,
|
||||
float3 vNormal : NORMAL,
|
||||
float2 vTexCoord0 : TEXCOORD,
|
||||
uniform int nNumLights,
|
||||
uniform bool bTexture,
|
||||
uniform bool bAnimate )
|
||||
{
|
||||
VS_OUTPUT Output;
|
||||
...
|
||||
return Output;
|
||||
}
|
||||
|
||||
// From https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-function-syntax
|
||||
52
node_modules/shiki/samples/html.sample
generated
vendored
Normal file
52
node_modules/shiki/samples/html.sample
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>MDN Web Docs Example: Toggling full-screen mode</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<style class="editable">
|
||||
video::backdrop {
|
||||
background-color: #448;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- import the webpage's javascript file -->
|
||||
<script src="script.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="preview">
|
||||
<video controls
|
||||
src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
|
||||
poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
|
||||
width="620">
|
||||
|
||||
Sorry, your browser doesn't support embedded videos. Time to upgrade!
|
||||
|
||||
</video>
|
||||
</section>
|
||||
|
||||
<textarea class="playable playable-css" style="height: 100px;">
|
||||
video::backdrop {
|
||||
background-color: #448;
|
||||
}
|
||||
</textarea>
|
||||
|
||||
<textarea class="playable playable-html" style="height: 200px;">
|
||||
<video controls
|
||||
src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
|
||||
poster="https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
|
||||
width="620">
|
||||
Sorry, your browser doesn't support embedded videos. Time to upgrade!
|
||||
</video>
|
||||
</textarea>
|
||||
|
||||
<div class="playable-buttons">
|
||||
<input id="reset" type="button" value="Reset" />
|
||||
</div>
|
||||
</body>
|
||||
<script src="playable.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- From https://github.com/mdn/css-examples/blob/main/backdrop/index.html -->
|
||||
18
node_modules/shiki/samples/http.sample
generated
vendored
Normal file
18
node_modules/shiki/samples/http.sample
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Basic authentication
|
||||
GET http://example.com
|
||||
Authorization: Basic username password
|
||||
|
||||
###
|
||||
|
||||
// Digest authentication
|
||||
GET http://example.com
|
||||
Authorization: Digest username password
|
||||
|
||||
// The request body is provided in place
|
||||
POST https://example.com:8080/api/html/post HTTP/1.1
|
||||
Content-Type: application/json
|
||||
Cookie: key=first-value
|
||||
|
||||
{ "key" : "value", "list": [1, 2, 3] }
|
||||
|
||||
// From https://www.jetbrains.com/help/idea/exploring-http-syntax.html#use-multipart-form-data
|
||||
55
node_modules/shiki/samples/imba.sample
generated
vendored
Normal file
55
node_modules/shiki/samples/imba.sample
generated
vendored
Normal 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
|
||||
12
node_modules/shiki/samples/ini.sample
generated
vendored
Normal file
12
node_modules/shiki/samples/ini.sample
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
; last modified 1 April 2001 by John Doe
|
||||
[owner]
|
||||
name = John Doe
|
||||
organization = Acme Widgets Inc.
|
||||
|
||||
[database]
|
||||
; use IP address in case network name resolution is not working
|
||||
server = 192.0.2.62`
|
||||
port = 143
|
||||
file = "payroll.dat"
|
||||
|
||||
; From https://en.wikipedia.org/wiki/INI_file
|
||||
36
node_modules/shiki/samples/java.sample
generated
vendored
Normal file
36
node_modules/shiki/samples/java.sample
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import java.awt.Rectangle;
|
||||
|
||||
public class ObjectVarsAsParameters
|
||||
{ public static void main(String[] args)
|
||||
{ go();
|
||||
}
|
||||
|
||||
public static void go()
|
||||
{ Rectangle r1 = new Rectangle(0,0,5,5);
|
||||
System.out.println("In method go. r1 " + r1 + "\n");
|
||||
// could have been
|
||||
//System.out.prinltn("r1" + r1.toString());
|
||||
r1.setSize(10, 15);
|
||||
System.out.println("In method go. r1 " + r1 + "\n");
|
||||
alterPointee(r1);
|
||||
System.out.println("In method go. r1 " + r1 + "\n");
|
||||
|
||||
alterPointer(r1);
|
||||
System.out.println("In method go. r1 " + r1 + "\n");
|
||||
}
|
||||
|
||||
public static void alterPointee(Rectangle r)
|
||||
{ System.out.println("In method alterPointee. r " + r + "\n");
|
||||
r.setSize(20, 30);
|
||||
System.out.println("In method alterPointee. r " + r + "\n");
|
||||
}
|
||||
|
||||
public static void alterPointer(Rectangle r)
|
||||
{ System.out.println("In method alterPointer. r " + r + "\n");
|
||||
r = new Rectangle(5, 10, 30, 35);
|
||||
System.out.println("In method alterPointer. r " + r + "\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// From https://www.cs.utexas.edu/~scottm/cs307/javacode/codeSamples/ObjectVarsAsParameters.java
|
||||
29
node_modules/shiki/samples/javascript.sample
generated
vendored
Normal file
29
node_modules/shiki/samples/javascript.sample
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
function resolveAfter2Seconds(x) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(x);
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
// async function expression assigned to a variable
|
||||
const add = async function (x) {
|
||||
const a = await resolveAfter2Seconds(20);
|
||||
const b = await resolveAfter2Seconds(30);
|
||||
return x + a + b;
|
||||
};
|
||||
|
||||
add(10).then((v) => {
|
||||
console.log(v); // prints 60 after 4 seconds.
|
||||
});
|
||||
|
||||
// async function expression used as an IIFE
|
||||
(async function (x) {
|
||||
const p1 = resolveAfter2Seconds(20);
|
||||
const p2 = resolveAfter2Seconds(30);
|
||||
return x + (await p1) + (await p2);
|
||||
})(10).then((v) => {
|
||||
console.log(v); // prints 60 after 2 seconds.
|
||||
});
|
||||
|
||||
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/async_function
|
||||
22
node_modules/shiki/samples/jinja-html.sample
generated
vendored
Normal file
22
node_modules/shiki/samples/jinja-html.sample
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{# templates/results.html #}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Results</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>{{ test_name }} Results</h1>
|
||||
<ul>
|
||||
{% for student in students %}
|
||||
<li>
|
||||
<em>{{ student.name }}:</em> {{ student.score }}/{{ max_score }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{# From https://realpython.com/primer-on-jinja-templating/#use-if-statements #}
|
||||
61
node_modules/shiki/samples/jison.sample
generated
vendored
Normal file
61
node_modules/shiki/samples/jison.sample
generated
vendored
Normal 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 */
|
||||
38
node_modules/shiki/samples/json.sample
generated
vendored
Normal file
38
node_modules/shiki/samples/json.sample
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"squadName": "Super hero squad",
|
||||
"homeTown": "Metro City",
|
||||
"formed": 2016,
|
||||
"secretBase": "Super tower",
|
||||
"active": true,
|
||||
"members": [
|
||||
{
|
||||
"name": "Molecule Man",
|
||||
"age": 29,
|
||||
"secretIdentity": "Dan Jukes",
|
||||
"powers": ["Radiation resistance", "Turning tiny", "Radiation blast"]
|
||||
},
|
||||
{
|
||||
"name": "Madame Uppercut",
|
||||
"age": 39,
|
||||
"secretIdentity": "Jane Wilson",
|
||||
"powers": [
|
||||
"Million tonne punch",
|
||||
"Damage resistance",
|
||||
"Superhuman reflexes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Eternal Flame",
|
||||
"age": 1000000,
|
||||
"secretIdentity": "Unknown",
|
||||
"powers": [
|
||||
"Immortality",
|
||||
"Heat Immunity",
|
||||
"Inferno",
|
||||
"Teleportation",
|
||||
"Interdimensional travel"
|
||||
]
|
||||
}
|
||||
],
|
||||
"from": "https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON"
|
||||
}
|
||||
41
node_modules/shiki/samples/json5.sample
generated
vendored
Normal file
41
node_modules/shiki/samples/json5.sample
generated
vendored
Normal 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',
|
||||
},
|
||||
}
|
||||
|
||||
// From https://github.com/mrmlnc/vscode-json5/blob/master/syntaxes/json5.json
|
||||
34
node_modules/shiki/samples/jsonc.sample
generated
vendored
Normal file
34
node_modules/shiki/samples/jsonc.sample
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// A jsonc example document
|
||||
{
|
||||
owner:{
|
||||
name:`komkom`
|
||||
dob: /* just some random dob */ `1975-01-25T12:00:00-02:00`
|
||||
}
|
||||
|
||||
database:{ // our live db
|
||||
server:`192.168.1.1`
|
||||
ports:[8001,8002,8003]
|
||||
connectionMax:5000
|
||||
enabled:true
|
||||
}
|
||||
|
||||
servers:{ // a server
|
||||
alpha:{
|
||||
ip: /* is soon invalid */ `10.0.0.1`
|
||||
dc:`eqdc10`
|
||||
}
|
||||
|
||||
beta:{
|
||||
ip:`10.0.0.2`
|
||||
dc:`eqdc10`
|
||||
}
|
||||
}
|
||||
|
||||
clients:{
|
||||
data:[["gamma","delta"],[1,2]]
|
||||
}
|
||||
|
||||
hosts:[alpha,omega]
|
||||
}
|
||||
|
||||
// From https://github.com/komkom/jsonc
|
||||
31
node_modules/shiki/samples/jsonl.sample
generated
vendored
Normal file
31
node_modules/shiki/samples/jsonl.sample
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
|
||||
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
|
||||
{"name": "May", "wins": []}
|
||||
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
|
||||
{
|
||||
"name": "Gilbert",
|
||||
"wins": [
|
||||
[
|
||||
"straight",
|
||||
"7♣"
|
||||
],
|
||||
[
|
||||
"one pair",
|
||||
"10♥"
|
||||
]
|
||||
]
|
||||
}
|
||||
{
|
||||
"name": "Alexa",
|
||||
"wins": [
|
||||
[
|
||||
"two pair",
|
||||
"4♠"
|
||||
],
|
||||
[
|
||||
"two pair",
|
||||
"9♠"
|
||||
]
|
||||
]
|
||||
}
|
||||
// From https://jsonlines.org/examples/
|
||||
33
node_modules/shiki/samples/jsonnet.sample
generated
vendored
Normal file
33
node_modules/shiki/samples/jsonnet.sample
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/* A C-style comment. */
|
||||
# A Python-style comment.
|
||||
{
|
||||
cocktails: {
|
||||
// Ingredient quantities are in fl oz.
|
||||
'Tom Collins': {
|
||||
ingredients: [
|
||||
{ kind: "Farmer's Gin", qty: 1.5 },
|
||||
{ kind: 'Lemon', qty: 1 },
|
||||
{ kind: 'Simple Syrup', qty: 0.5 },
|
||||
{ kind: 'Soda', qty: 2 },
|
||||
{ kind: 'Angostura', qty: 'dash' },
|
||||
],
|
||||
garnish: 'Maraschino Cherry',
|
||||
served: 'Tall',
|
||||
description: |||
|
||||
The Tom Collins is essentially gin and
|
||||
lemonade. The bitters add complexity.
|
||||
|||,
|
||||
},
|
||||
Manhattan: {
|
||||
ingredients: [
|
||||
{ kind: 'Rye', qty: 2.5 },
|
||||
{ kind: 'Sweet Red Vermouth', qty: 1 },
|
||||
{ kind: 'Angostura', qty: 'dash' },
|
||||
],
|
||||
garnish: 'Maraschino Cherry',
|
||||
served: 'Straight Up',
|
||||
description: @'A clear \ red drink.',
|
||||
},
|
||||
},
|
||||
}
|
||||
# From https://jsonnet.org/learning/tutorial.html
|
||||
22
node_modules/shiki/samples/jssm.sample
generated
vendored
Normal file
22
node_modules/shiki/samples/jssm.sample
generated
vendored
Normal 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
|
||||
30
node_modules/shiki/samples/jsx.sample
generated
vendored
Normal file
30
node_modules/shiki/samples/jsx.sample
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
function Item({ name, isPacked }) {
|
||||
if (isPacked) {
|
||||
return null;
|
||||
}
|
||||
return <li className="item">{name}</li>;
|
||||
}
|
||||
|
||||
export default function PackingList() {
|
||||
return (
|
||||
<section>
|
||||
<h1>Sally Ride's Packing List</h1>
|
||||
<ul>
|
||||
<Item
|
||||
isPacked={true}
|
||||
name="Space suit"
|
||||
/>
|
||||
<Item
|
||||
isPacked={true}
|
||||
name="Helmet with a golden leaf"
|
||||
/>
|
||||
<Item
|
||||
isPacked={false}
|
||||
name="Photo of Tam"
|
||||
/>
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// From https://react.dev/learn/conditional-rendering
|
||||
16
node_modules/shiki/samples/julia.sample
generated
vendored
Normal file
16
node_modules/shiki/samples/julia.sample
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
function mandelbrot(a)
|
||||
z = 0
|
||||
for i=1:50
|
||||
z = z^2 + a
|
||||
end
|
||||
return z
|
||||
end
|
||||
|
||||
for y=1.0:-0.05:-1.0
|
||||
for x=-2.0:0.0315:0.5
|
||||
abs(mandelbrot(complex(x, y))) < 2 ? print("*") : print(" ")
|
||||
end
|
||||
println()
|
||||
end
|
||||
|
||||
# From: https://rosettacode.org/wiki/Mandelbrot_set#Julia
|
||||
149
node_modules/shiki/samples/kotlin.sample
generated
vendored
Normal file
149
node_modules/shiki/samples/kotlin.sample
generated
vendored
Normal 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
7
node_modules/shiki/samples/kusto.sample
generated
vendored
Normal 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/
|
||||
31
node_modules/shiki/samples/latex.sample
generated
vendored
Normal file
31
node_modules/shiki/samples/latex.sample
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
% This is a simple sample document. For more complicated documents take a look in the exercise tab. Note that everything that comes after a % symbol is treated as comment and ignored when the code is compiled.
|
||||
|
||||
\documentclass{article} % \documentclass{} is the first command in any LaTeX code. It is used to define what kind of document you are creating such as an article or a book, and begins the document preamble
|
||||
|
||||
\usepackage{amsmath} % \usepackage is a command that allows you to add functionality to your LaTeX code
|
||||
|
||||
\title{Simple Sample} % Sets article title
|
||||
\author{My Name} % Sets authors name
|
||||
\date{\today} % Sets date for date compiled
|
||||
|
||||
% The preamble ends with the command \begin{document}
|
||||
\begin{document} % All begin commands must be paired with an end command somewhere
|
||||
\maketitle % creates title using information in preamble (title, author, date)
|
||||
|
||||
\section{Hello World!} % creates a section
|
||||
|
||||
\textbf{Hello World!} Today I am learning \LaTeX. %notice how the command will end at the first non-alphabet charecter such as the . after \LaTeX
|
||||
\LaTeX{} is a great program for writing math. I can write in line math such as $a^2+b^2=c^2$ %$ tells LaTexX to compile as math
|
||||
. I can also give equations their own space:
|
||||
\begin{equation} % Creates an equation environment and is compiled as math
|
||||
\gamma^2+\theta^2=\omega^2
|
||||
\end{equation}
|
||||
If I do not leave any blank lines \LaTeX{} will continue this text without making it into a new paragraph. Notice how there was no indentation in the text after equation (1).
|
||||
Also notice how even though I hit enter after that sentence and here $\downarrow$
|
||||
\LaTeX{} formats the sentence without any break. Also look how it doesn't matter how many spaces I put between my words.
|
||||
|
||||
For a new paragraph I can leave a blank space in my code.
|
||||
|
||||
\end{document} % This is the end of the document
|
||||
|
||||
% From https://guides.nyu.edu/LaTeX/sample-document
|
||||
31
node_modules/shiki/samples/less.sample
generated
vendored
Normal file
31
node_modules/shiki/samples/less.sample
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
.button {
|
||||
&-ok {
|
||||
background-image: url("ok.png");
|
||||
}
|
||||
&-cancel {
|
||||
background-image: url("cancel.png");
|
||||
}
|
||||
|
||||
&-custom {
|
||||
background-image: url("custom.png");
|
||||
}
|
||||
}
|
||||
.link {
|
||||
& + & {
|
||||
color: red;
|
||||
}
|
||||
|
||||
& & {
|
||||
color: green;
|
||||
}
|
||||
|
||||
&& {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
&, &ish {
|
||||
color: cyan;
|
||||
}
|
||||
}
|
||||
|
||||
// From https://lesscss.org/features/#parent-selectors-feature
|
||||
14
node_modules/shiki/samples/liquid.sample
generated
vendored
Normal file
14
node_modules/shiki/samples/liquid.sample
generated
vendored
Normal 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 -%}
|
||||
25
node_modules/shiki/samples/lisp.sample
generated
vendored
Normal file
25
node_modules/shiki/samples/lisp.sample
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
;;; testing.lisp
|
||||
;;; by Philip Fong
|
||||
;;;
|
||||
;;; Introductory comments are preceded by ";;;"
|
||||
;;; Function headers are preceded by ";;"
|
||||
;;; Inline comments are introduced by ";"
|
||||
;;;
|
||||
|
||||
;;
|
||||
;; Triple the value of a number
|
||||
;;
|
||||
|
||||
(defun triple (X)
|
||||
"Compute three times X." ; Inline comments can
|
||||
(* 3 X)) ; be placed here.
|
||||
|
||||
;;
|
||||
;; Negate the sign of a number
|
||||
;;
|
||||
|
||||
(defun negate (X)
|
||||
"Negate the value of X." ; This is a documentation string.
|
||||
(- X))
|
||||
|
||||
;;; From https://www2.cs.sfu.ca/CourseCentral/310/pwfong/Lisp/1/tutorial1.html
|
||||
21
node_modules/shiki/samples/logo.sample
generated
vendored
Normal file
21
node_modules/shiki/samples/logo.sample
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
print word "apple "sauce
|
||||
; applesauce
|
||||
|
||||
print word "3 "4
|
||||
; 34
|
||||
|
||||
print 12 + word "3 "4
|
||||
; 46
|
||||
|
||||
to factorial :number
|
||||
if :number = 1 [output 1]
|
||||
output :number * factorial :number - 1
|
||||
end
|
||||
|
||||
print factorial 3
|
||||
; 6
|
||||
|
||||
print factorial 5
|
||||
; 120
|
||||
|
||||
; From https://el.media.mit.edu/logo-foundation/what_is_logo/logo_programming.html
|
||||
18
node_modules/shiki/samples/lua.sample
generated
vendored
Normal file
18
node_modules/shiki/samples/lua.sample
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
ball = {
|
||||
xpos = 60,
|
||||
ypos = 60,
|
||||
|
||||
-- without the colon syntax, must mention self argument explicitly
|
||||
move = function(self, newx, newy)
|
||||
self.xpos = newx
|
||||
self.ypos = newy
|
||||
end
|
||||
}
|
||||
|
||||
-- using the colon, ball is passed as self automatically
|
||||
ball:move(100, 120)
|
||||
|
||||
-- using the dot, must pass self explicitly
|
||||
ball.move(ball, 100, 120)
|
||||
|
||||
-- From https://pico-8.fandom.com/wiki/Lua
|
||||
26
node_modules/shiki/samples/make.sample
generated
vendored
Normal file
26
node_modules/shiki/samples/make.sample
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
edit : main.o kbd.o command.o display.o \
|
||||
insert.o search.o files.o utils.o
|
||||
cc -o edit main.o kbd.o command.o display.o \
|
||||
insert.o search.o files.o utils.o
|
||||
|
||||
main.o : main.c defs.h
|
||||
cc -c main.c
|
||||
kbd.o : kbd.c defs.h command.h
|
||||
cc -c kbd.c
|
||||
command.o : command.c defs.h command.h
|
||||
cc -c command.c
|
||||
display.o : display.c defs.h buffer.h
|
||||
cc -c display.c
|
||||
insert.o : insert.c defs.h buffer.h
|
||||
cc -c insert.c
|
||||
search.o : search.c defs.h buffer.h
|
||||
cc -c search.c
|
||||
files.o : files.c defs.h buffer.h command.h
|
||||
cc -c files.c
|
||||
utils.o : utils.c defs.h
|
||||
cc -c utils.c
|
||||
clean :
|
||||
rm edit main.o kbd.o command.o display.o \
|
||||
insert.o search.o files.o utils.o
|
||||
|
||||
# From https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html
|
||||
161
node_modules/shiki/samples/markdown.sample
generated
vendored
Normal file
161
node_modules/shiki/samples/markdown.sample
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
An h1 header
|
||||
============
|
||||
|
||||
Paragraphs are separated by a blank line.
|
||||
|
||||
2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists
|
||||
look like:
|
||||
|
||||
* this one
|
||||
* that one
|
||||
* the other one
|
||||
|
||||
Note that --- not considering the asterisk --- the actual text
|
||||
content starts at 4-columns in.
|
||||
|
||||
> Block quotes are
|
||||
> written like so.
|
||||
>
|
||||
> They can span multiple paragraphs,
|
||||
> if you like.
|
||||
|
||||
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
|
||||
in chapters 12--14"). Three dots ... will be converted to an ellipsis.
|
||||
Unicode is supported. ☺
|
||||
|
||||
|
||||
|
||||
An h2 header
|
||||
------------
|
||||
|
||||
Here's a numbered list:
|
||||
|
||||
1. first item
|
||||
2. second item
|
||||
3. third item
|
||||
|
||||
Note again how the actual text starts at 4 columns in (4 characters
|
||||
from the left side). Here's a code sample:
|
||||
|
||||
# Let me re-iterate ...
|
||||
for i in 1 .. 10 { do-something(i) }
|
||||
|
||||
As you probably guessed, indented 4 spaces. By the way, instead of
|
||||
indenting the block, you can use delimited blocks, if you like:
|
||||
|
||||
~~~
|
||||
define foobar() {
|
||||
print "Welcome to flavor country!";
|
||||
}
|
||||
~~~
|
||||
|
||||
(which makes copying & pasting easier). You can optionally mark the
|
||||
delimited block for Pandoc to syntax highlight it:
|
||||
|
||||
~~~python
|
||||
import time
|
||||
# Quick, count to ten!
|
||||
for i in range(10):
|
||||
# (but not *too* quick)
|
||||
time.sleep(0.5)
|
||||
print(i)
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
### An h3 header ###
|
||||
|
||||
Now a nested list:
|
||||
|
||||
1. First, get these ingredients:
|
||||
|
||||
* carrots
|
||||
* celery
|
||||
* lentils
|
||||
|
||||
2. Boil some water.
|
||||
|
||||
3. Dump everything in the pot and follow
|
||||
this algorithm:
|
||||
|
||||
find wooden spoon
|
||||
uncover pot
|
||||
stir
|
||||
cover pot
|
||||
balance wooden spoon precariously on pot handle
|
||||
wait 10 minutes
|
||||
goto first step (or shut off burner when done)
|
||||
|
||||
Do not bump wooden spoon or it will fall.
|
||||
|
||||
Notice again how text always lines up on 4-space indents (including
|
||||
that last line which continues item 3 above).
|
||||
|
||||
Here's a link to [a website](http://foo.bar), to a [local
|
||||
doc](local-doc.html), and to a [section heading in the current
|
||||
doc](#an-h2-header). Here's a footnote [^1].
|
||||
|
||||
[^1]: Some footnote text.
|
||||
|
||||
Tables can look like this:
|
||||
|
||||
Name Size Material Color
|
||||
------------- ----- ------------ ------------
|
||||
All Business 9 leather brown
|
||||
Roundabout 10 hemp canvas natural
|
||||
Cinderella 11 glass transparent
|
||||
|
||||
Table: Shoes sizes, materials, and colors.
|
||||
|
||||
(The above is the caption for the table.) Pandoc also supports
|
||||
multi-line tables:
|
||||
|
||||
-------- -----------------------
|
||||
Keyword Text
|
||||
-------- -----------------------
|
||||
red Sunsets, apples, and
|
||||
other red or reddish
|
||||
things.
|
||||
|
||||
green Leaves, grass, frogs
|
||||
and other things it's
|
||||
not easy being.
|
||||
-------- -----------------------
|
||||
|
||||
A horizontal rule follows.
|
||||
|
||||
***
|
||||
|
||||
Here's a definition list:
|
||||
|
||||
apples
|
||||
: Good for making applesauce.
|
||||
|
||||
oranges
|
||||
: Citrus!
|
||||
|
||||
tomatoes
|
||||
: There's no "e" in tomatoe.
|
||||
|
||||
Again, text is indented 4 spaces. (Put a blank line between each
|
||||
term and its definition to spread things out more.)
|
||||
|
||||
Here's a "line block" (note how whitespace is honored):
|
||||
|
||||
| Line one
|
||||
| Line too
|
||||
| Line tree
|
||||
|
||||
and images can be specified like so:
|
||||
|
||||

|
||||
|
||||
Inline math equation: $\omega = d\phi / dt$. Display
|
||||
math should get its own line like so:
|
||||
|
||||
$$I = \int \rho R^{2} dV$$
|
||||
|
||||
And note that you can backslash-escape any punctuation characters
|
||||
which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc.
|
||||
|
||||
<!--- From http://www.unexpected-vortices.com/sw/rippledoc/quick-markdown-example.html -->
|
||||
13
node_modules/shiki/samples/marko.sample
generated
vendored
Normal file
13
node_modules/shiki/samples/marko.sample
generated
vendored
Normal 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/ -->
|
||||
22
node_modules/shiki/samples/matlab.sample
generated
vendored
Normal file
22
node_modules/shiki/samples/matlab.sample
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
clear
|
||||
number = input('Give an integer: ');
|
||||
remainder2 = rem(number,2);
|
||||
remainder3 = rem(number,3);
|
||||
|
||||
if remainder2==0 & remainder3==0
|
||||
'Your number is divisible by both 2 and 3'
|
||||
else
|
||||
if remainder2==0
|
||||
'Your number is divisble by 2 but not by 3'
|
||||
else
|
||||
if remainder3==0
|
||||
'Your number is divisible by 3 but not by 2'
|
||||
else
|
||||
'Your number is not divisible by either 2 or 3'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% From https://www.math.colostate.edu/~yzhou/course/matlab_doc/matlab_programming_intro.html
|
||||
13
node_modules/shiki/samples/mdc.sample
generated
vendored
Normal file
13
node_modules/shiki/samples/mdc.sample
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
::card
|
||||
---
|
||||
icon: Icon
|
||||
title: A complex card.
|
||||
---
|
||||
|
||||
Default slot
|
||||
|
||||
#description
|
||||
::alert
|
||||
Description slot
|
||||
::
|
||||
::
|
||||
13
node_modules/shiki/samples/mdx.sample
generated
vendored
Normal file
13
node_modules/shiki/samples/mdx.sample
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<MyComponent id="123" />
|
||||
|
||||
You can also use objects with components, such as the `thisOne` component on
|
||||
the `myComponents` object: <myComponents.thisOne />
|
||||
|
||||
<Component
|
||||
open
|
||||
x={1}
|
||||
label={'this is a string, *not* markdown!'}
|
||||
icon={<Icon />}
|
||||
/>
|
||||
|
||||
{/* From https://mdxjs.com/docs/what-is-mdx/#mdx-syntax */}
|
||||
23
node_modules/shiki/samples/mermaid.sample
generated
vendored
Normal file
23
node_modules/shiki/samples/mermaid.sample
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
graph TB
|
||||
sq[Square shape] --> ci((Circle shape))
|
||||
|
||||
subgraph A
|
||||
od>Odd shape]-- Two line<br/>edge comment --> ro
|
||||
di{Diamond with <br/> line break} -.-> ro(Rounded<br>square<br>shape)
|
||||
di==>ro2(Rounded square shape)
|
||||
end
|
||||
|
||||
%% Notice that no text in shape are added here instead that is appended further down
|
||||
e --> od3>Really long text with linebreak<br>in an Odd shape]
|
||||
|
||||
%% Comments after double percent signs
|
||||
e((Inner / circle<br>and some odd <br>special characters)) --> f(,.?!+-*ز)
|
||||
|
||||
cyr[Cyrillic]-->cyr2((Circle shape Начало));
|
||||
|
||||
classDef green fill:#9f6,stroke:#333,stroke-width:2px;
|
||||
classDef orange fill:#f96,stroke:#333,stroke-width:4px;
|
||||
class sq,e green
|
||||
class di orange
|
||||
|
||||
%% From https://mermaid.js.org/syntax/examples.html
|
||||
11
node_modules/shiki/samples/mojo.sample
generated
vendored
Normal file
11
node_modules/shiki/samples/mojo.sample
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
def softmax(lst):
|
||||
norm = np.exp(lst - np.max(lst))
|
||||
return norm / norm.sum()
|
||||
|
||||
struct NDArray:
|
||||
def max(self) -> NDArray:
|
||||
return self.pmap(SIMD.max)
|
||||
|
||||
struct SIMD[type: DType, width: Int]:
|
||||
def max(self, rhs: Self) -> Self:
|
||||
return (self >= rhs).select(self, rhs)
|
||||
92
node_modules/shiki/samples/narrat.sample
generated
vendored
Normal file
92
node_modules/shiki/samples/narrat.sample
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
quest_demo:
|
||||
set_button shopButton true
|
||||
set_button parkButton greyed
|
||||
jump bread_quest
|
||||
|
||||
bread_quest:
|
||||
choice:
|
||||
talk helper idle "Can you get 2 pieces of bread for me?"
|
||||
"Yes":
|
||||
talk helper idle "Thanks, that's very nice!"
|
||||
talk helper idle "I'll be waiting for you at the park"
|
||||
jump bread_start
|
||||
"No":
|
||||
talk helper idle "Oh, okay"
|
||||
jump quest_demo
|
||||
|
||||
bread_start:
|
||||
start_quest breadShopping
|
||||
talk inner idle "Time to go to the shop to buy some bread then."
|
||||
set_screen map
|
||||
set_button shopButton true
|
||||
|
||||
shopButton:
|
||||
// set_screen default
|
||||
"You visit the bread shop"
|
||||
talk shopkeeper idle "Hello, I'm a little baker selling bread and drinks!"
|
||||
set data.breadPrice 5
|
||||
jump shop_menu
|
||||
|
||||
parkButton:
|
||||
choice:
|
||||
talk helper idle "Ah, so do you have my bread?"
|
||||
"Yes!" if (>= $items.bread.amount 2):
|
||||
talk helper idle "Thanks a lot!"
|
||||
add_item bread -2
|
||||
complete_objective breadShopping delivery
|
||||
complete_quest breadShopping
|
||||
set_button parkButton false
|
||||
jump demo_end
|
||||
"No :(":
|
||||
talk helper idle "Oh okay"
|
||||
|
||||
shop_menu:
|
||||
choice:
|
||||
talk shopkeeper idle "So, do you want some bread?"
|
||||
"Buy bread (costs %{$$data.breadPrice})" if (>= $stats.money.value $data.breadPrice):
|
||||
add_item bread 1
|
||||
if (== $data.breadPrice 5):
|
||||
add_stat money -5
|
||||
else:
|
||||
add_stat money -4
|
||||
jump map_update
|
||||
roll bread_haggle haggling 50 "Try to haggle for bread" hideAfterRoll:
|
||||
success "You explain that helper cat needs bread to feed his poor family":
|
||||
add_xp haggling 10
|
||||
set data.breadPrice 4
|
||||
talk shopkeeper idle "I guess I can sell you bread for 4 coins"
|
||||
jump shop_menu
|
||||
failure "You try to pity trip the shopkeeper but he won't bulge":
|
||||
add_xp haggling 5
|
||||
talk shopkeeper idle "The price is 5 coins, nothing less, nothing more."
|
||||
jump shop_menu
|
||||
"Exit":
|
||||
jump map_update
|
||||
|
||||
show_map:
|
||||
set_button parkButton false
|
||||
set_button shopButton true
|
||||
set_screen map
|
||||
|
||||
map_update:
|
||||
set_button parkButton false
|
||||
set_button shopButton true
|
||||
log $items.bread
|
||||
if (>= $items.bread.amount 2):
|
||||
complete_objective breadShopping bread
|
||||
talk inner idle "I've got enough bread now, I'm going to go to the park."
|
||||
start_objective breadShopping delivery
|
||||
set_screen map
|
||||
set_button parkButton true
|
||||
set_button shopButton false
|
||||
else:
|
||||
talk inner idle "Hmm, I still need to buy more bread for helper cat."
|
||||
set_screen map
|
||||
|
||||
eat_bread:
|
||||
talk player idle "hmm, bread"
|
||||
|
||||
read_book:
|
||||
talk inner idle "It's full of ocult rituals. I'm not sure what they are, but I'm sure they are useful."
|
||||
|
||||
// From: https://github.com/liana-p/narrat-engine/blob/main/packages/narrat/examples/games/demo/data/quest.narrat
|
||||
63
node_modules/shiki/samples/nextflow.sample
generated
vendored
Normal file
63
node_modules/shiki/samples/nextflow.sample
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* The following pipeline parameters specify the reference genomes
|
||||
* and read pairs and can be provided as command line options
|
||||
*/
|
||||
params.reads = "$baseDir/data/ggal/ggal_gut_{1,2}.fq"
|
||||
params.transcriptome = "$baseDir/data/ggal/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"
|
||||
params.outdir = "results"
|
||||
|
||||
workflow {
|
||||
read_pairs_ch = channel.fromFilePairs( params.reads, checkIfExists: true )
|
||||
|
||||
INDEX(params.transcriptome)
|
||||
FASTQC(read_pairs_ch)
|
||||
QUANT(INDEX.out, read_pairs_ch)
|
||||
}
|
||||
|
||||
process INDEX {
|
||||
tag "$transcriptome.simpleName"
|
||||
|
||||
input:
|
||||
path transcriptome
|
||||
|
||||
output:
|
||||
path 'index'
|
||||
|
||||
script:
|
||||
"""
|
||||
salmon index --threads $task.cpus -t $transcriptome -i index
|
||||
"""
|
||||
}
|
||||
|
||||
process FASTQC {
|
||||
tag "FASTQC on $sample_id"
|
||||
publishDir params.outdir
|
||||
|
||||
input:
|
||||
tuple val(sample_id), path(reads)
|
||||
|
||||
output:
|
||||
path "fastqc_${sample_id}_logs"
|
||||
|
||||
script:
|
||||
"""
|
||||
fastqc.sh "$sample_id" "$reads"
|
||||
"""
|
||||
}
|
||||
|
||||
process QUANT {
|
||||
tag "$pair_id"
|
||||
publishDir params.outdir
|
||||
|
||||
input:
|
||||
path index
|
||||
tuple val(pair_id), path(reads)
|
||||
|
||||
output:
|
||||
path pair_id
|
||||
|
||||
script:
|
||||
"""
|
||||
salmon quant --threads $task.cpus --libType=U -i $index -1 ${reads[0]} -2 ${reads[1]} -o $pair_id
|
||||
"""
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user