This file contains hidden or 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
| 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 |
This file contains hidden or 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 { | |
| /* color variables */ | |
| --brand-black: #1B1132; | |
| --brand-white: #FBFBFB; | |
| --black: #000000; | |
| --white: #FFFFFF; | |
| --red-700: #820500; | |
| --red-300: #FDC9C6; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder