{{< emgithub permalink="https://github.com/yusanshi/embed-like-gist/blob/master/embed.js" showFileMeta="off" showLineNumbers="off">}}
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
From the source repository: | |
```sh | |
git clone <src_repository> <src_repository>_clone | |
# clone the src repository in new folder | |
``` | |
```sh | |
cd <src_repository>_clone | |
``` |
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 wait = (milliSeconds) => { | |
return new Promise((resolve) => setTimeout(() => resolve(), milliSeconds)); | |
}; | |
wait(200).then(() => { | |
// your code | |
}); | |
// async/await context | |
await wait(200); |
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 wait = (milliSeconds) => { | |
return new Promise((resolve) => setTimeout(() => resolve(), milliSeconds)); | |
}; | |
const retry = ({fn, maxRetries, initialDelayMs, intervalMs}) => { | |
// first attempt after the initial delay | |
let attempts = wait(initialDelayMs); | |
if ( maxRetries > 0) { | |
attempts = attempts.then(() => fn()); | |
} |
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
class TenIntegers: | |
def __init__(self, start_from=0): | |
self.current=start_from | |
self.max = self.current + 10 | |
def __iter__(self): | |
''' | |
This method makes the object iterable | |
''' |
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
# Mac/Linux | |
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \; | |
# Windows | |
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d" |
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
#!/bin/bash | |
# Sometimes you need to move your existing git repository | |
# to a new remote repository (/new remote origin). | |
# Here are a simple and quick steps that does exactly this. | |
# | |
### OPTION 1 ########################################################################################### | |
# Let's assume we call "old repo" the repository you wish | |
# to move, and "new repo" the one you wish to move to. | |
# |
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
git merge --no-commit --no-ff <BRANCH-TO-MERGE> | |
echo $? | |
git merge --abort |
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
# from https://stackoverflow.com/a/30352360/6816965 | |
# 1. clone the publish repo and push it into the private one | |
git clone --bare https://github.com/exampleuser/public-repo.git | |
cd public-repo.git | |
git push --mirror https://github.com/yourname/private-repo.git | |
cd .. | |
rm -rf public-repo.git | |
# 2. work on the private repository as usual |
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
{"id": "4be19430264ba409f67d318897b61a6134220d8781885bf13516e0a10414c3dc94dd61d7df835881982215e53e9776490e1dfcec697f4f8a3d030fac95abe23a"} |
OlderNewer