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> | |
<style>body { padding: 0; }</style> | |
<script src='https://cdn.jsdelivr.net/p5.js/0.3.2/p5.min.js'></script> | |
<script src='out/goog/base.js'></script> | |
<script src='myproject.js'></script> | |
<script>goog.require('myproject.core')</script> |
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
(ns localstorage) | |
(defn set-item! | |
"Set `key' in browser's localStorage to `val`." | |
[key val] | |
(.setItem (.-localStorage js/window) key val)) | |
(defn get-item | |
"Returns value of `key' from browser's localStorage." | |
[key] |
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
struct Control { | |
pub id: i32, | |
} | |
struct UI<'a> { | |
pub control: &'a Control, | |
} | |
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
trait Rendered { | |
fn render(&mut self); | |
} | |
struct TextLabel { | |
} | |
impl Rendered for TextLabel { | |
fn render(&mut self) { | |
println!("TextLabel"); |
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
#![allow(unused)] | |
pub mod sdl { | |
pub struct Sdl2<'a> { | |
pub version: &'a str | |
} | |
impl<'a> Sdl2<'a> { |
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
#![allow(unused)] | |
#[derive(Debug)] | |
struct TextEngine { | |
id: u32, | |
} | |
#[derive(Debug)] | |
struct Ui { | |
engine: TextEngine, |
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
fn main() { | |
let s1 = "hello"; | |
let s2 = String::from("hello"); | |
let s3 = String::from("hello"); | |
println!("s1 == s2 => {}", s1 == s2); | |
println!("s1 == s3 => {}", s1 == s3); | |
println!("s2 == s3 => {}", s2 == s3); | |
} |
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
const FIZZABLE: u8 = 3; | |
const BUZZABLE: u8 = 5; | |
const FIZZBUZZABLE: u8 = FIZZABLE * BUZZABLE; | |
fn main() { | |
for i in 1..101 { | |
if i % FIZZBUZZABLE == 0 { | |
print!("FizzBuzz"); | |
} | |
else if i % BUZZABLE == 0 { |
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
#[derive(Debug)] | |
struct Node<'a> { | |
id: &'a str, | |
children: Option<Vec<Node<'a>>>, | |
} | |
fn make_leaf<'a>(id: &'a str) -> Node<'a> { | |
Node { | |
id: id, | |
children: None |
OlderNewer