Skip to content

Instantly share code, notes, and snippets.

View gamecubate's full-sized avatar

Alexandre Rousseau gamecubate

View GitHub Profile
@phoboslab
phoboslab / touch-button.js
Last active August 10, 2021 14:44
Touch Button Plugin for Impact
ig.module(
'plugins.touch-button'
)
.requires(
'impact.system',
'impact.input',
'impact.image'
)
.defines(function(){ "use strict";
@sander
sander / index.html
Created August 10, 2014 23:54
p5.js in ClojureScript
<!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>
@daveliepmann
daveliepmann / localstorage.cljs
Created September 23, 2014 08:23
HTML5 localStorage utility functions for ClojureScript. I find it makes for cleaner code when I wrap the native JS.
(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]
@rust-play
rust-play / playground.rs
Created April 8, 2019 20:24
Code shared from the Rust Playground
struct Control {
pub id: i32,
}
struct UI<'a> {
pub control: &'a Control,
}
@rust-play
rust-play / playground.rs
Created April 11, 2019 20:49
Code shared from the Rust Playground
trait Rendered {
fn render(&mut self);
}
struct TextLabel {
}
impl Rendered for TextLabel {
fn render(&mut self) {
println!("TextLabel");
@rust-play
rust-play / playground.rs
Created April 12, 2019 21:28
Code shared from the Rust Playground
#![allow(unused)]
pub mod sdl {
pub struct Sdl2<'a> {
pub version: &'a str
}
impl<'a> Sdl2<'a> {
@rust-play
rust-play / playground.rs
Created April 23, 2019 19:00
Code shared from the Rust Playground
#![allow(unused)]
#[derive(Debug)]
struct TextEngine {
id: u32,
}
#[derive(Debug)]
struct Ui {
engine: TextEngine,
@rust-play
rust-play / playground.rs
Created April 23, 2019 19:01
Code shared from the Rust Playground
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);
}
@rust-play
rust-play / playground.rs
Created April 26, 2019 21:56
Code shared from the Rust Playground
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 {
@rust-play
rust-play / playground.rs
Created April 26, 2019 22:30
Code shared from the Rust Playground
#[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