This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HelloWorld with | |
var int id; | |
do | |
_printf("[%d] Hello world!\n", this.id); | |
every 1s do | |
_printf("[%d] Hello world!\n", this.id); | |
end | |
end | |
class HelloMulticellular with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sdl.ceu" | |
#include "sdl-gfx.ceu" | |
input void SDL_REDRAW; | |
input void SDL_QUIT; | |
input int SDL_DT; | |
input _SDL_KeyboardEvent* SDL_KEYDOWN; | |
native do | |
SDL_Renderer* REN = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SleepSorter with | |
var int t; | |
do | |
await (t)ms; | |
_printf("%d ", t); | |
end | |
par/or do | |
var SleepSorter[100000] sorter with | |
this.t = (_rand()%100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lookup table for precalculated sine values - basically LUT[t % 512] == (byte)(255 * sin(2 * Pi * t / 512)) | |
byte LUT[512] = { | |
0, 1, 1, 1, 1, 1, 1, 1, 1, | |
1, 1, 2, 2, 2, 2, 3, 3, | |
3, 4, 4, 4, 5, 5, 6, 6, | |
6, 7, 7, 8, 9, 9, 10, 10, | |
11, 11, 12, 13, 13, 14, 15, 16, | |
16, 17, 18, 19, 20, 20, 21, 22, | |
23, 24, 25, 26, 27, 28, 29, 30, | |
31, 32, 33, 34, 35, 36, 37, 38, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*======================================================================== | |
== DEMO: ARRAYS == | |
========================================================================= | |
So far, we can only create one variable at a time: | |
__________________________________________________________________________ | |
| | | |
| int x = 100000; | | |
|________________________________________________________________________| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sdl.ceu" | |
#include "sdl-gfx.ceu" | |
input void SDL_REDRAW; | |
input void SDL_QUIT; | |
input int SDL_DT; | |
input _SDL_KeyboardEvent&& SDL_KEYDOWN; | |
input _SDL_KeyboardEvent&& SDL_KEYUP; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {PropTypes} from 'react'; | |
import { debounce } from 'lodash'; | |
// A simple helper component, wrapping retina logic for canvas and | |
// auto-resizing the canvas to fill its parent container. | |
// To determine size/layout, we just use CSS on the div containing | |
// the Canvas component (we're using this with flexbox, for example). | |
// Expects a "paint" function that takes a "context" to draw on | |
// Whenever this component updates it will call this paint function | |
// to draw on the canvas. For convenience, pixel dimensions are stored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>charAt vs array lookup + string vs array indexOf comparison</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>split string into segments: regex vs substr vs split/slice/join (plus plain split for comparison)</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>string segments of two: substr vs regex</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
OlderNewer