• Stars
    star
    491
  • Rank 89,636 (Top 2 %)
  • Language
    JavaScript
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Wasm By Example is a website with a set of hands-on introduction examples and tutorials for WebAssembly (Wasm)

wasm-by-example

Travis Status License: CC BY 4.0

Wasm By Example is a website containing simple examples for how to get things done with wasm.

Wasm By Example Website Header

Table of Contents

Motivation

This project is heavily inspired by Go By Example. Wasm is still relatively young, and I thought it would be great to have a similar, hands-on / tutorial / introduction into WebAssembly for those who "learn by doing".

Getting Started

One-time Setup

  1. Create a GitHub account if you don't already have one.

  2. Install and set up Git.

  3. Install the latest LTS version of Node.js (which includes npm). An easy way to do so is with nvm. (Mac and Linux: here, Windows: here)

    nvm install --lts
  4. Create your own fork of the wasm-by-example repository by clicking "Fork" in the Web UI. During local development, this will be referred to by git as origin.

  5. Download your fork to a local repository.

    git clone [email protected]:<your username>/wasm-by-example.git
  6. Add an alias called upstream to refer to the main torch2424/wasm-by-example repository. Go to the root directory of the newly created local repository directory and run:

    git remote add upstream [email protected]:torch2424/wasm-by-example.git
  7. Fetch data from the upstream remote:

    git fetch upstream master
  8. Set up your local master branch to track upstream/master instead of origin/master (which will rapidly become outdated).

    git branch -u upstream/master master

Branch (do this each time you want a new branch)

Create and go to the branch:

git checkout -b <branch name> master

Building & Running the project

  1. Make sure you have the latest packages (after you pull): npm install
  2. To build the project, run: npm run build
  3. To serve, and build on changes for the project, run: npm run dev

Contributing

Thank you for wanting to contribute! Below is a guide for contributing different parts of the project:

Examples

Examples are the individual examples, concepts, or ideas conveyed for each language. Examples are laid out in the following format:

examples/EXAMPLE_NAME/EXAMPLE_NAME.PROGRAMMING_LANGUAGE.READING_LANGUAGE.md

Where the variables represent the following ideas:

  • EXAMPLE_NAME - is the name / title of the example.
  • PROGRAMMING_LANGUAGE - is the programming language used for the code snippets (e.g Rust).
  • READING_LANGUAGE - is the language that the idea is read / spoken (e.g English).

It is highly recommended examples also offer a demo where reasonable. Demos should be placed:

examples/EXAMPLE_NAME/demo/PROGRAMMING_LANGUAGE

Please place all relevant files there, and feel free to serve via an iframe, or link to the full source code. It is also recommended you offer a README.md to explain the demo, or simply offer build instructions.

Now that we understand how examples are made, let's see some general guidance for contributing examples:

Creating a new Example

Awesome! Glad to see new examples and ideas! I'd recommended opening an issue before contributing an entirely new example. This way we can discuss if the example idea is beneficial, and to bring awareness to other contributors that ma want to do any translations and things.

After the idea has been discussed, feel free to open a PR following the format explained above, and we can review and add it to the website!

By default, all new examples will be last in the example list on the homepage. To set the order of your example, add your example's name to the array in build-system/example-order.js to set its order.

Adding a new Programming Language to an existing Example

If you are adding a new programming language, feel free to simply open a new PR with the format explained above, and we can review and add it to the website! NOTE: It is highly recommended you add a demo of your example, unless there is a good reason for not providing one.

Adding a new Reading Language (Translation) to an existing Example

If you are adding a new reading language, feel free to simply open a new PR with the format explained above, and we can review and add it to the website! New reading languages don't require a new demo or anything like that, and simply translate the written text between examples where it seems right.

Adding a completely new Reading Language (Translation)

If you would like to add a new language that is not supported at all in the project, first of all, THANK YOU SO MUCH! :)

To get started with this, you will want to do the following steps:

  1. Open an issue, just to let maintainers know you would like to add a new language, so we can help :)
  2. Add your reading language to build-system/homepage.js. As well as, add translations to the fields on the objects with your corresponding lnaguage key (For example, English(US) is "en-us").
  3. Add your reading language to the shell/js/index.js.
  4. See the steps outlined in Adding a new Reading Language (Translation) to an existing Example to start translating examples! They should appear on the homepage as you add them!

Improving the shell (the base website)

Improving the shell (E.g the language switcher or typos in the landing page and things), feel free to open a PR! For larger ideas or new sections of the site, it is recommended to open an issue first for discussion.

Any other contributions

For all other types of contributions (E.g perhaps you are a platform that wants to expand on Wasm By Example or something), please open an issue first describing the idea, and then we can work on a PR that works for the community at large.

Privacy

Google Analytics is used on Wasm By Example, and is only used to record Basic visit data, as the script is only loaded.

License

This work is copyright Aaron Turner and licensed under a Creative Commons Attribution 4.0 License.

More Repositories

1

wasmboy

Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀Demos built with Preact and Svelte. ⚛ī¸
WebAssembly
1,395
star
2

vaporBoy

Gameboy / Gameboy Color Emulator PWA built with Preact. ⚛ī¸ Powered by wasmBoy. 🎮Themed with VaporWave. 🌴đŸŦ
JavaScript
254
star
3

as-bind

Isomorphic library to handle passing high-level data structures between AssemblyScript and JavaScript 🤝🚀
WebAssembly
244
star
4

live-stream-radio

24/7 live stream video radio station CLI / API 📹 đŸ“ģ
JavaScript
242
star
5

picoDeploy

Deploy Pico-8 Carts as Standalone Applications on Desktop đŸ–Ĩī¸(Electron) and Mobile 📱(Ionic) đŸ“Ļ👾
TypeScript
220
star
6

made-with-webassembly

A showcase of awesome production applications, side projects, and use cases made with WebAssembly (Wasm). 👷
JavaScript
210
star
7

aesthetic-css

A vaporwave CSS framework 🌴đŸŦ
CSS
199
star
8

wasm-matrix

A Matrix effect in your terminal using AssemblyScript 🚀 and WASI 🧩 . Deployed to WAPM đŸ“Ļ .
TypeScript
70
star
9

responsive-gamepad

Handle Keyboard, Gamepad, and Touch Controls under a single API 🕹ī¸
JavaScript
44
star
10

dotFiles

A repo containing all the cool stuff that makes my ~ feel like $HOME. 🏠
Shell
14
star
11

pocketChipScripts

Some nice scripts to ease the process of pocket chip-ing
Shell
12
star
12

wasm-containerization-talk

Examples featured in my "The Legend of WebAssembly, and the Missing Link" talk. Mostly trying to show off how we can use Wasm and Wasi to containerize applications.
C
8
star
13

Stats-Monitor-Widget

A conky like system monitor widget for android
Java
6
star
14

as-date

Staging AssemblyScript Date implementation by @LiaoPeng , as an installable AssemblyScript library
TypeScript
6
star
15

simple-pastebin

A Chrome Extension that is literally just a <textarea>, that saves to localStorage. Paste stuff, and it automatically saves as you paste/type! 📋
JavaScript
6
star
16

sass-bem-mixins

importable Sass BEM mixins
SCSS
4
star
17

assemblyscript-website

JavaScript
4
star
18

radical-rumble-robots

A fighting game for the GameBoy
C
4
star
19

Decisions

A simple decision making app for android
Java
4
star
20

wasi-syscall-playground

A repo for little wasi wat demos I am making for syscalls I am hoping that will exist one day 😂
WebAssembly
3
star
21

wasm-playground

A Wasm playground with preact as a shell, and assemblyscript as the wasm build tool
JavaScript
3
star
22

as-bind-hello-world

A hello world for as-bind.
WebAssembly
3
star
23

crunchkey-2

It's Crunchkey, but 2. Built with AssemblyScript (WebAssembly)!
TypeScript
3
star
24

vagrantBox

Vagrant files to make my life ALOT easier, it will set up virtual dev environments for all of my codes
Shell
3
star
25

shared-gb-js

Shared JS code between my Gameboy Projects 🎮
JavaScript
2
star
26

Crunchkey-Web

A website for the instant calculator chrome plugin, Made this for a class when I first learned some webdev
HTML
2
star
27

link-drops

A collection of your links that you find across the internet, made with the help of @julianpoy
CSS
2
star
28

TxtNote

A simple .txt note taking app for android
Java
2
star
29

chipGo

Another Chip-8 Emulator Written in Go
Go
2
star
30

CrunchKey

Chrome plugin to calculate strings realtime
JavaScript
2
star
31

StarSamurai

Project for BeachHacks 2016, 2d action platformer game. Built in Unity
C#
2
star
32

pixel-pages

Simple landing pages meant to send page view and conversion events to tracking pixels
JavaScript
1
star
33

devops

My devops setup and tools for my servers
HTML
1
star
34

PersonalSite

My old website to showcase my work and portfolio. Made in AngularJS
CSS
1
star
35

link-drops-chrome-extension

The Official Chrome Extension for linkDrops!
JavaScript
1
star
36

as-regex-wasi-demo

A demo of trying assemblyscript-regex in a WASI context
WebAssembly
1
star
37

CECS343JavaResturant

Resturant group project for CECS 343
Java
1
star
38

piStreamRadio-frontend

A frontend web client for piStreamRadio
HTML
1
star
39

pubx

Really simple pub/sub state management 📋
JavaScript
1
star
40

CECS-476-SysAdmin

Homeworks for 476
Python
1
star
41

Feather

A Media/Video Playing app for android
Java
1
star
42

as-echo

A very simple `echo` implementation in AssemblyScript. 🚀
WebAssembly
1
star
43

small-rust-wasm-hello-world

Just a super small rust wasm hello world. Wanted to see how big it would be in bytes :)
Rust
1
star
44

working-group

A repo for discussions, goals, roadmaps, assets, and other things related to the AssemblyScript project.
1
star
45

Transplant-Client

A beautiful Electron SFTP/FTP Client
JavaScript
1
star
46

amp-mutations-benchmark

Tool to benchmark mutation operations on an amp page
JavaScript
1
star
47

personal-site-amp

My personal website, made in AMP
HTML
1
star
48

wasmer-js-playground

Playground for testing wasmer-js
JavaScript
1
star
49

dotRetropie

Config and Dotfiles for retropie
Squirrel
1
star
50

CrunchKey-Ionic

Crunchkey Created in Ionic, for Web and Mobile
CSS
1
star
51

wasmboy-plugin-hqx

Plugin for WasmBoy to add support for hqx upscaling. Built with Rust for WebAssembly.
JavaScript
1
star