- Fork the repo
- Clone the repo
git checkout -b NEW_BRANCHgit remote add upstream ORIGINAL_REPO_URL- Make changes
- Commit and push changes
- Open your repo on Github
- Click Compare & pull request
- Enter description
- Click Create pull request
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
| function download(filename, filepath) { | |
| let element = document.createElement('a'); | |
| element.setAttribute('href', filepath); | |
| element.setAttribute('download', filename); | |
| element.style.display = 'none'; | |
| document.body.appendChild(element); | |
| element.click(); | |
| document.body.removeChild(element); | |
| } |
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
| // takes props: | |
| // apiKey: string | |
| // mapOptions: object | |
| // mapID: string | |
| // onMapLoad: function(mapOject) | |
| // mapLibraries: array[string] | |
| // Function Version |
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
| function isOpenNow(place) { | |
| const date = new Date(); | |
| const day = date.getDay(); | |
| const hours = date.getHours(); | |
| const minutes = date.getMinutes(); | |
| const currentTime = (day * 24 + hours) * 60 + minutes; | |
| // calculate the current number of minutes into the week | |
| let currentlyOpen = false; |
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
| .container { | |
| position: relative; | |
| } | |
| .object: { | |
| position: absolute; | |
| top: 50%; // moves the element 50% from the top of the container | |
| left: 50%; // moves the element 50% from the left of the container | |
| transform: translate(-50%, -50%); // move the element back up and to the left half of its total size | |
| } |
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
| $gap: 1rem; | |
| .grid { | |
| display: flex; | |
| margin: 0 calc(#{$gap} / -2) -$gap calc(#{$gap} / -2); | |
| flex-wrap: wrap; | |
| } | |
| .item { | |
| flex: 0 0 auto; |
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
| const getDadJoke = async () => { | |
| const dadJoke = await fetch("https://icanhazdadjoke.com/", { | |
| headers: { | |
| Accept: "application/json" | |
| } | |
| }); | |
| const dadJokeJSON = await dadJoke.json(); | |
| if (dadJokeJSON.status === 200) { | |
| return dadJokeJSON.joke; | |
| } else { |
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": "eslint-prettier-demo", | |
| "version": "0.1.0", | |
| "private": true, | |
| "dependencies": { | |
| "react": "^16.9.0", | |
| "react-dom": "^16.9.0", | |
| "react-scripts": "3.1.1" | |
| }, | |
| "scripts": { |
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
| function parseEmojis(str) { | |
| return str.match(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/); | |
| } |
A somewhat niche problem is opening a centered popup window when you have multiple monitors. One you case you might encounter for this is opening a Twitter Web Intent window, which creates a tweet for a user to post. Here is their recomended code for opening a Web Intent popup:
(function() {
if (window.__twitterIntentHandler) return;
var intentRegex = /twitter\.com\/intent\/(\w+)/,
windowOptions = 'scrollbars=yes,resizable=yes,toolbar=no,location=yes',
width = 550,
height = 420,
winHeight = screen.height,OlderNewer