Skip to content

Instantly share code, notes, and snippets.

@pmurias
pmurias / TUTORIAL.md
Last active October 16, 2019 14:29
start of tutorial

The easiest way to try out rakudo.js is to try use 6pad If you load it in your browser you can run Raku code without installing anything.

To share or view example keep in mind 6pad can run gists. If you create a gist like https://gist.github.com/pmurias/b5d2414766e7a87969cb26a9e67a72a2 6pad will load the code you put in main.p6 if you pass it like https://perl6.github.io/6pad/#b5d2414766e7a87969cb26a9e67a72a2

If you type this into 6pad and press run you will receive a generic welcome from rakudo.js

<span id='greeting'></span>
@pmurias
pmurias / main.p6
Created October 15, 2019 14:39
Hello World
say "Hello World";
@pmurias
pmurias / main.p6
Last active October 15, 2019 12:57
A simple Hello World
say "Hello World";
say "Hello World";
<html>
<head>
</head>
<body>
<canvas id='spaceship' height='500' width='500'></canvas>
</body>
</html>

Dependencies

Install node 10.16.0 or 12.3.1 from https://nodejs.org

Getting started with node.js rakudo.js

The easiest way is to install the rakudo package from npm

mkdir tutorial-project # Create a fresh project directory
# Dependencies
Install node 10.16.0 or 12.3.1 from https://nodejs.org
# Getting started with node.js rakudo.js
The easiest way is to install the rakudo package from npm
```bash
mkdir tutorial-project # Create a fresh project directory
@pmurias
pmurias / index.html
Created September 23, 2019 10:57
Spaceship drawing demo
<html>
<head>
<script defer src="spaceship.p6"></script>
</head>
<body style='background-color: blue'>
<canvas id='spaceship' height='500' width='500' style='border: 1px pink;'></canvas>
</body>
</html>
@pmurias
pmurias / chalk.p6
Created June 20, 2019 13:28
Example of using a node.js module in rakudo.js
use lib 'nodejs#' ~ $*PROGRAM.parent.add('node_modules').absolute;
use chalk:from<node.js>;
say("Hello {chalk.blue("Blue")} World");