this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

VERY BAD JOKE SETUPS

phil 01c2c0d6 3a4684e1

+22 -5
-1
shared/examples/day_three_build_car.rs
··· 6 6 &("codes.advent.supersecret.verification".parse().unwrap()), 7 7 &("1337".parse().unwrap()), 8 8 "ABCDE-FGHIJ", 9 - "what did the muffin say to the other muffin?", 10 9 ) 11 10 .await 12 11 .expect("failed to build car");
-1
shared/src/advent/challenges/day_three/day_three.rs
··· 49 49 &("codes.advent.supersecret.verification".parse().unwrap()), 50 50 &("1337".parse().unwrap()), 51 51 &code, 52 - "hellooooooo", 53 52 ) 54 53 .await 55 54 .map_err(|e| AdventError::ShouldNotHappen(format!("failed to render car: {e}")))?;
+22 -3
shared/src/advent/challenges/day_three/repo.rs
··· 3 3 use atrium_api::types::string::{Nsid, RecordKey}; 4 4 use atrium_crypto::keypair::P256Keypair; 5 5 use atrium_repo::{Repository, blockstore::{CarStore, MemoryBlockStore}}; 6 + use rand::seq::IndexedRandom; 6 7 use serde::Serialize; 7 8 8 9 const CHALLENGE_DID: &str = "did:plc:3oktyyf7u4ecnvdwf3ogehpd"; 9 10 11 + const VERY_BAD_JOKE_SETUPS: &[&str] = &[ 12 + "what do you call a cow with two legs?", 13 + "what do bees do if they need a ride?", 14 + "what do you call a monkey that loves doritos?", 15 + "why did the can crusher quit her job?", 16 + "when’s the best time to go to the dentist?", 17 + "why do seagulls fly over the sea?", 18 + "what do you call a farm that makes bad jokes?", 19 + "why do fish live in saltwater?", 20 + "what kind of streets do ghosts haunt?", 21 + "what do you call it when one cow spies on another?", 22 + "what happens when a frog’s car breaks down?", 23 + "what does a zombie vegetarian eat?", 24 + "what do you call it when a snowman throws a tantrum?", 25 + "why did the scarecrow win an award?", 26 + "what did the buffalo say when his son left?", 27 + "wait, you don’t want to hear a joke about potassium?", 28 + ]; 29 + 10 30 #[derive(Debug, thiserror::Error)] 11 31 pub enum CarBuildError { 12 32 #[error("Signing error: {0}")] ··· 33 53 collection: &Nsid, 34 54 rkey: &RecordKey, 35 55 verification_code: &str, 36 - message: &str, 37 56 ) -> Result<Vec<u8>, CarBuildError> { 38 57 let did = CHALLENGE_DID.parse().unwrap(); 39 58 ··· 47 66 // add record 48 67 let key = format!("{}/{}", collection.as_str(), rkey.as_str()); 49 68 let created_at = &chrono::Utc::now().to_rfc3339(); 69 + let joke = VERY_BAD_JOKE_SETUPS.choose(&mut rand::rng()).unwrap_or(&"no joke"); 50 70 let record = ChallengeRecord { 51 71 created_at, 52 72 verification_code, 53 - message, 73 + message: joke, 54 74 }; 55 75 let (cb, _cid) = repo.add_raw(&key, record).await?; 56 76 let sig = keypair.sign(&cb.bytes())?; ··· 75 95 &("codes.advent.supersecret.verification".parse().unwrap()), 76 96 &("1337".parse().unwrap()), 77 97 "ABCDE-FGHIJ", 78 - "what did the muffin say to the other muffin?", 79 98 ) 80 99 .await 81 100 .expect("build a car");