User:HiyaHiya/Codebox: Difference between revisions
Appearance
No edit summary |
|||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
jThis is dawgdawgdawg's codebox. Experimenting with the really, really big selection of languages in the code block menu | |||
== ABAP == | |||
<syntaxhighlight lang="abap"> | |||
REPORT TEST. | REPORT TEST. | ||
WRITE 'Hello World'. | WRITE 'Hello World'. | ||
| Line 11: | Line 14: | ||
</syntaxhighlight> | |||
== js == | |||
<syntaxhighlight lang="js"> | |||
// this is javascript ^_^ | |||
// chatgpt really helped | |||
function isPrime(number) { | |||
if (number <= 1) { | |||
return false; | |||
} | |||
for (let i = 2; i * i <= number; i++) { | |||
if (number % i === 0) { | |||
return false; | |||
} | |||
} | |||
return true; | |||
} | |||
const num = 17; | |||
if (isPrime(num)) { | |||
console.log(num + " is a prime number."); | |||
} else { | |||
console.log(num + " is not a prime number."); | |||
} | |||
</syntaxhighlight> | |||
== js+cheetah == | |||
<syntaxhighlight lang="js+cheetah"> | |||
// Import the CheetahJS library | |||
import cheetah from 'cheetahjs'; | |||
// Define the ViewModel | |||
const viewModel = { | |||
firstName: 'John', | |||
lastName: 'Doe', | |||
fullName: function() { | |||
return this.firstName + " " + this.lastName; | |||
} | |||
}; | |||
// Bind the ViewModel to the HTML | |||
cheetah.bind(viewModel, document.getElementById('app')); | |||
</syntaxhighlight> | |||
== c == | |||
<syntaxhighlight lang="c"> | |||
#include <stdio.h> | |||
int main(){ | |||
printf("Hello, This is a program in C"); | |||
return 0; | |||
} | |||
</syntaxhighlight> | |||
== html == | |||
<syntaxhighlight lang="html" line="1"> | |||
<!DOCTYPE HTML> | |||
<!-- | |||
list of things i found here | |||
--> | |||
<html> | |||
<head> | |||
</head> | |||
<body> | |||
<a href="https://owot.me">owot.me</a> | |||
<!-- A elements are anchor elements and allow you to link things --> | |||
<abbr title="Hypertext Markup Language">HTML</abbr> | |||
<!-- abbr elements are abbreviation elements --> | |||
<address> | |||
Written by <a href="mailto:dawgdawgdawg@dawg.com">dawgdawgdawg</a>.<br> | |||
Visit us at:<br> | |||
dawgdawgdawg.com<br> | |||
Dawg Street, Dawglandia<br> | |||
Dawgopolis | |||
</address> | |||
<!-- address elements are useful for writing addresses, both digital and physical. --> | |||
<img src="http://dawgvideo.rf.gd/textwallsq.png" alt="squares" usemap="#owotsq"> | |||
<map name="owotsq"> | |||
<area shape="rect" coords="76,117,238,279" alt="OWOT square" href="https://owot.me"> | |||
<area shape="rect" coords="414,176,621,358" alt="Textwall square" href="https://textwall.cc"> | |||
</map> | |||
<!-- i actually just learned about the area and map elements! i wanted to make such a thing for a very long time --> | |||
<article> | |||
This is an article. No visual form of the div like element tho. | |||
</article> | |||
<!-- article is for semantic purposes only. --> | |||
<aside>Another semantic</aside> | |||
<!-- aside is also used for semantic purposes. --> | |||
<audio controls src="https://files.catbox.moe/zflzaa.mp3"></audio> | |||
<!-- audio allows you to play audio on a webpage. | |||
put "controls" on your audio element, and it will get controls. | |||
This is basically required. | |||
put "autoplay" and it will autoplay. | |||
put "muted" and it will mute. | |||
--> | |||
<b>Bold text!</b> | |||
<!-- b allows you to bold text. --> | |||
</body> | |||
</html> | |||
</syntaxhighlight> | |||
== assembly == | |||
<syntaxhighlight lang="asm"> | |||
section .data | |||
hello: db "Hello, World!",10 ; declare the hello world variable | |||
strlength: equ $-hello ; declare the length of the hello world variable and stick it in a other variable | |||
section .text | |||
global _start | |||
_start: | |||
mov eax,4 | |||
mov ebx,1 ; blah blah blah, you already know what this is | |||
mov ecx,hello | |||
mov edx,strlength ; this just puts the string in the console | |||
int 80h | |||
mov eax,1 ; the end of the program | |||
mov ebx,0 | |||
int 80h | |||
</syntaxhighlight> | </syntaxhighlight> | ||