55import yaml
66from pathlib import Path
77
8- from requests_cache import CachedSession
9-
10- from resume .badges import devicons_badges
11- from resume .salutations import typed_salutations
8+ from itertools import product
9+ import json
10+ import random
1211
13- class HttpClient (CachedSession ):
14- def __init__ (self , expire_after = None ):
15- CachedSession .__init__ (self ,
16- cache_name = 'mycull.dev' ,
17- use_temp = True ,
18- expire_after = timedelta (minutes = 30 ) if expire_after is None else expire_after ,
19- )
12+ import requests
2013
2114NLJ = partial ('\n ' .join )
2215JSDELIVR_DEVICONS = "https://cdn.jsdelivr.net/gh/devicons/devicon@master/icons"
@@ -32,7 +25,7 @@ def __init__(self, expire_after=None):
3225 f"{ JSDELIVR_DEVICONS } /{ icon ['name' ]} /{ icon ['name' ]} -{ icon ['versions' ]['svg' ][0 ]} .svg" ,
3326 icon ['color' ],
3427 )
35- for icon in HttpClient () .get (DEVICONS_GITHUB ).json ()
28+ for icon in requests .get (DEVICONS_GITHUB ).json ()
3629}
3730
3831def load_resume (format = 'yaml' , name = 'resume' ):
@@ -84,9 +77,65 @@ def devicons_badges(company=None):
8477
8578 return badges
8679
80+ def salutation_permutations ():
81+ """Say 'Hello, my name is' in a bunch of ways"""
82+ hellojis = '👋 🌊 🙋 🖖' .split ()
83+ # https://www.babbel.com/en/magazine/how-to-say-hello-in-10-different-languages
84+ hello = """
85+ hi yo oi
86+ sup hey olá hoi hai hej
87+ ciao hiya aweh hola haai molo
88+ heita hello salut ahlan
89+ howzit hoesit dumela halløj goddag
90+ sawubona
91+ """ .split ()
92+ hello .extend (['whakind eksê' , 'hoe lyk it' ])
93+ hello = 'hi yo sup hiya hey haai aweh hola molo haai' .split ()
94+ # my_names_are = ['my name is', 'my naam is', 'igama lami ngu']
95+ popeyes = ["i'm " , "ek is " , "ngingu" , "ke " ]
96+ amongst_our_names = "michael michel mikhail mihály mícheál michele michal miguel mihail michiel mikel mihangel mícheál mikkel" .split ()
97+
98+ # https://smodin.io/translate-one-text-into-multiple-languages
99+
100+ salutation_permutations = list (product (
101+ hellojis , hello , popeyes , amongst_our_names
102+ ))
103+ random .shuffle (salutation_permutations )
104+
105+ salutations = [
106+ f'🤓{ emoji } { hello } , { my_name_is } { me } '
107+ for emoji , hello , my_name_is , me in salutation_permutations
108+ ]
109+ return salutations
110+
111+ TYPED_JS = "https://cdn.jsdelivr.net/npm/[email protected] " 112+ TYPED_TEMPLATE = """
113+ <script src="{js_url}"></script>
114+ <script>
115+ var typed = new Typed('{dom_element}', {options});
116+ </script>
117+ """
118+
119+ def typed_js (dom_element , things_to_type ):
120+ options = json .dumps (dict (
121+ startDelay = 3000 ,
122+ smartDelete = True ,
123+ showCursor = False ,
124+ typeSpeed = 50 ,
125+ strings = things_to_type ,
126+ ))
127+ return TYPED_TEMPLATE .format (
128+ js_url = TYPED_JS ,
129+ dom_element = dom_element ,
130+ options = options
131+ )
132+
87133def skills_badges (company = None ):
88134 return NLJ (devicons_badges (company ))
89135
136+ def typed_salutations ():
137+ return typed_js ('h1' , salutation_permutations ())
138+
90139def define_env (env ):
91140 env .variables ['skills_badges' ] = skills_badges
92141 env .variables ['typed_salutations' ] = typed_salutations
0 commit comments