Skip to content

Instantly share code, notes, and snippets.

View gamecubate's full-sized avatar

Alexandre Rousseau gamecubate

View GitHub Profile
@gramcha
gramcha / having-multiple-jdk-macos.md
Created November 28, 2020 14:34
Managing multiple Java versions in MacOS

Installing different versions of open jdk through Homebrew(assuming already installed) and already having Java 8.

We need to install a tool called jenv - Java version manager which is similar to nvm(nodeJs version manager).

brew install jenv

Export the jenv path to .bash_profile or .zshrc - whatever you are using. I am using .zshrc

@rust-play
rust-play / playground.rs
Created April 27, 2019 00:26
Code shared from the Rust Playground
// Filled circle algorithm with edge softening
fn main() {
let w = 12;
let r: f32 = w as f32 / 2.0;
println!("=================================================");
println!("radius: {}", r);
println!("=================================================");
println!("col,row -> dx,dy -> dist from center -> diff -> alpha");
println!("=================================================");
@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
@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 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 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 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 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 8, 2019 20:24
Code shared from the Rust Playground
struct Control {
pub id: i32,
}
struct UI<'a> {
pub control: &'a Control,
}
@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]