Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am timbod7 on github.
  • I am timbod77 (https://keybase.io/timbod77) on keybase.
  • I have a public key ASByGqS9snO0G55GNTafZo8imOe6NCTOCKJPomdnmB88Hgo

To claim this, I am signing this object:

@timbod7
timbod7 / maps.rs
Created Jul 3, 2018
maybe create an optional reference inside a map
View maps.rs
fn get_or_insert1<'a>(map: &'a mut HashMap<String,String>, key:&String) -> &'a mut String {
map.entry(key.clone()).or_insert_with(|| String::new())
}
fn get_or_insert2<'a>(map: &'a mut HashMap<String,String>, key:&String) -> &'a mut String {
match map.get_mut(key) {
Some(v) => v,
None => {
map.entry(key.clone()).or_insert(String::new())
}
@timbod7
timbod7 / aws-codeworld.sh
Last active Aug 29, 2015
Setup an Amazon Linux EC2 instance to run codeworld
View aws-codeworld.sh
# Update and install basic dependencies
sudo yum update -y
sudo yum install -y git
sudo yum install -y zlib-devel
sudo yum install -y ncurses-devel
# Needed for ghcjs-boot --dev