This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ 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 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
liveData: { | |
boxscore: { | |
teams: { | |
[home | away]: { | |
teamStats: { | |
pitching: { | |
strikeouts: Number | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span role="img" aria-label="clap"> | |
<!-- unicode for clapping hand emoji --> | |
👏 | |
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- this is a valid js comment | |
--> and so is this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//I typically use promise chains to handle | |
//sync control but today I'm playing around with generators. | |
//View on Repl: https://repl.it/KWdA/1 | |
function *myGen() { | |
var one = yield 1; | |
var two = yield 2; | |
var three = yield 3; | |
console.log(one, two, three); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get rid of GIFs and make it so that text truncates at line break or X characters | |
-Did a height w/ overflow control. Removed GIFs | |
vertically align image in bio and stop text at ~”in the form of” | |
-Vertical align of image not needed now that text has been shortened | |
Make links to repos and live site same size | |
-removed link borders |
NewerOlder