commit
817f7816c6
@ -0,0 +1 @@
|
||||
/target
|
@ -0,0 +1,17 @@
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
#[!feature(
|
||||
use melly_valentines::choose_saying::choose_saying;
|
||||
use std::lazy::OnceCell;
|
||||
|
||||
static sayings = OnceCell::new();
|
||||
|
||||
#[get("/")]
|
||||
fn a() -> String {
|
||||
return choose_saying(sayings.get().expect("Could not get sayings list."));
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build().mount("/", routes![a])
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "melly-valentines"
|
||||
authors = ["Tait Hoyem <tait@tait.tech>"]
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
rocket = "0.5.0-rc.1"
|
||||
rand = "^0.8.4"
|
||||
lazy_static = "^1.4.0"
|
@ -0,0 +1,6 @@
|
||||
# melly-valentines
|
||||
|
||||
This is for my girlfriend!!
|
||||
|
||||
As a challenge, she said that I should make a program with only 214 characters (reported by `wc -c`).
|
||||
If more than one file, then every file must be 214 characters.
|
@ -0,0 +1,11 @@
|
||||
sayings/squishy.txt
|
||||
sayings/love.txt
|
||||
sayings/programming.txt
|
||||
sayings/special-melly.txt
|
||||
sayings/generic.txt
|
||||
sayings/food.txt
|
||||
sayings/blind.txt
|
||||
sayings/sex.txt
|
||||
sayings/drugs.txt
|
||||
sayings/music.txt
|
||||
sayings/techies.txt
|
@ -0,0 +1,9 @@
|
||||
I'm nobody! Who are you?
|
||||
Are you nobody, too?
|
||||
Then there's a pair of us - don't tell!
|
||||
They'd banish us.
|
||||
|
||||
How dreary to be somebody!
|
||||
How public, like a frog
|
||||
To tell your name the livelong day
|
||||
To an admiring bogger!
|
@ -0,0 +1,10 @@
|
||||
I'm your potato!
|
||||
Eating hashbrowns? Sounds like you cheated on me with my cousin!
|
||||
You're my melon!
|
||||
Glizzy!
|
||||
I'm your tater tot!
|
||||
Good melon!
|
||||
You're one in a melon!
|
||||
You're my favourite cabbage!
|
||||
You're a snack!
|
||||
Tasty!
|
@ -0,0 +1,8 @@
|
||||
I love you!
|
||||
I love your programs!
|
||||
I love eating food with you!
|
||||
I love you, you love me; don't forget to hold your pee!
|
||||
I love your cuddles!
|
||||
I love squishing your face!
|
||||
I love booping your nose!
|
||||
I love hugging you!
|
@ -0,0 +1,6 @@
|
||||
"I'm coming on a jetplane; I know when I'll see you again!"
|
||||
"I'm on the highway to shell!"
|
||||
"Don't worry! Be Happy!"
|
||||
"把明天的煩惱交給明天"
|
||||
"The coconut nut is a giant nut!"
|
||||
"Co-co-nut co-co-co-co-co-nut"
|
@ -0,0 +1,12 @@
|
||||
*my_heart
|
||||
love++;
|
||||
squishy++;
|
||||
tait.location = "Vancouver";
|
||||
for (int i = 0;;i++) { printf("Love you %d!", i); }
|
||||
hug++;
|
||||
sad--;
|
||||
while (true) { distance--; }
|
||||
happy++;
|
||||
hungry++;
|
||||
sappy++;
|
||||
int bank_account_amnt = INT_MAX;
|
@ -0,0 +1,2 @@
|
||||
Smelly Melly!
|
||||
belly, button
|
@ -0,0 +1,9 @@
|
||||
Squishy!!!
|
||||
You are my squishy, my only squishy!
|
||||
Squish me!
|
||||
I will squish you, soon!
|
||||
You're a good squishy!
|
||||
Squishable you!
|
||||
Coming Soon: Squishy! (Rated R)
|
||||
We'll make a lot of mini squishies!
|
||||
Good morning, squishy!
|
@ -0,0 +1,3 @@
|
||||
I'd like to peek at every one of your directories.
|
||||
unzip; strip; touch; grep; mount; fsck; yes; more; fsck; fsck; umount; clean; sleep;
|
||||
Run `curl https://melody-214.tait.tech` for more info funny sayings
|
@ -0,0 +1,11 @@
|
||||
use lazy_static;
|
||||
use crate::sayings::read_all_sayings;
|
||||
use std::sync::Mutex;
|
||||
|
||||
lazy_static! {
|
||||
static ref SAYINGS: Mutex<Vec<String>> = Mutex::new(read_all_sayings());
|
||||
}
|
||||
|
||||
pub fn all_sayings() -> Vec<String> {
|
||||
SAYINGS.lock().expect("Error locking SAYINGS.").to_vec()
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
extern crate rand;
|
||||
use rand::thread_rng;
|
||||
use crate::all_sayings::all_sayings;
|
||||
use crate::choose_saying::rand::prelude::IteratorRandom;
|
||||
|
||||
pub fn random_saying() -> String {
|
||||
let mut rng = thread_rng();
|
||||
all_sayings().iter().choose(&mut rng).expect("Error getting random saying.").to_string()
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
use std::env as osenv;
|
||||
|
||||
pub fn gcf() -> String {
|
||||
let val = match osenv::var("MELLY_CORE") {
|
||||
Ok(var) => var,
|
||||
Err(_e) => {
|
||||
panic!("Environment variable MELLY_CORE is not found!");
|
||||
},
|
||||
};
|
||||
val
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
pub mod saying_files;
|
||||
pub mod env;
|
||||
pub mod ns;
|
||||
pub mod choose_saying;
|
||||
pub mod sayings;
|
||||
pub mod all_sayings;
|
||||
#[macro_use] extern crate lazy_static;
|
@ -0,0 +1,14 @@
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
extern crate lazy_static;
|
||||
use melly_valentines::choose_saying::random_saying;
|
||||
|
||||
#[get("/")]
|
||||
fn a() -> String {
|
||||
random_saying()
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build().mount("/", routes![a])
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
pub fn new_saying() -> String {
|
||||
return "Helo!".to_string();
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
use std::fs;
|
||||
use crate::env::gcf;
|
||||
|
||||
pub fn get_files() -> Vec<String> {
|
||||
fs::read_to_string(gcf())
|
||||
.expect("Error reading core file")
|
||||
.lines()
|
||||
.map(|x| x.to_string())
|
||||
.collect()
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
use crate::saying_files::get_files;
|
||||
|
||||
pub fn read_all_sayings() -> Vec<String> {
|
||||
get_files()
|
||||
.iter()
|
||||
.map(|n| n.lines().map(|l| l.to_string()))
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
Loading…
Reference in new issue