Skip to content

Instantly share code, notes, and snippets.

View leovolving's full-sized avatar

Leo Yockey leovolving

View GitHub Profile
@leovolving
leovolving / lorem-ipsum-30k.txt
Last active September 19, 2025 16:37
Lorem Ipsum text repeated enough times to be at least 30k characters.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
html {
/* color variables */
--brand-black: #1B1132;
--brand-white: #FBFBFB;
--black: #000000;
--white: #FFFFFF;
--red-700: #820500;
--red-300: #FDC9C6;
@leovolving
leovolving / html-to-plain-text.js
Created April 18, 2023 19:30
Converts html string to plain text, adding a single whitespace between tags
// html string includes line break
const htmlString = "<h1 style=\"\">test</h1><p style=\"\">line</p><p style=\"\">break</p><p style=\"\">testing <strong>foo</strong> testing</p><ul><li><p style=\"\">this</p></li><li><p style=\"\">and this</p></li></ul>"
// creates a new html document
const htmlDom = new DOMParser().parseFromString(htmlString, 'text/html')
console.log(htmlDom.body.children) // HTMLCollection(5) [h1, p, p, p, ul]
const plainText = Array
.from(htmlDom.body.children, e => e.innerText) // map fn is 2nd argument in Array.from
@leovolving
leovolving / wnba_champions.js
Last active October 31, 2024 16:13
Array of WNBA champions, sorted by year
[
{ name: 'Houston Comets', year: 1997 },
{ name: 'Houston Comets', year: 1998 },
{ name: 'Houston Comets', year: 1999 },
{ name: 'Houston Comets', year: 2000 },
{ name: 'Los Angeles Sparks', year: 2001 },
{ name: 'Los Angeles Sparks', year: 2002 },
{ name: 'Detroit Shock', year: 2003 },
{ name: 'Seattle Storm', year: 2004 },
{ name: 'Sacramento Monarchs', year: 2005 },
@leovolving
leovolving / mlb-live-game-data.js
Created April 18, 2021 18:52
MLB Live Game Data Object
{
liveData: {
boxscore: {
teams: {
[home | away]: {
teamStats: {
pitching: {
strikeouts: Number
}
}
@leovolving
leovolving / a11y-emoji.html
Last active April 17, 2020 20:36
accessible HTML rendering of the clapping hand emoji
<span role="img" aria-label="clap">
<!-- unicode for clapping hand emoji -->
&#128079;
</span>
<!-- this is a valid js comment
--> and so is this
@leovolving
leovolving / GetRequest.swift
Created September 11, 2017 01:39
GET Request Using Swift
//A basic GET request using the Ron Swanson Quote API
// https://github.com/jamesseanwright/ron-swanson-quotes
let targetUrl = URL(string: "http://ron-swanson-quotes.herokuapp.com/v2/quotes")
let task = URLSession.shared.dataTask(with: targetUrl!) { (data, response, error) in
if error != nil {
print("ERROR!")
}
else {
if let content = data {
# prints 0-9
for x in range(10):
print x
# prints 1-10
for x in range(1, 11):
print x
# remember, we don't need to declare variables
# we can just assign them
def true_or_false(bool):
if bool == True:
return "This is a true statement!"
else:
return "This is a false statement!"
print true_or_false(False) # returns the else block