async function printFiles () {
const files = await getFilePaths();
for (const file of files) {
const contents = await fs.readFile(file, 'utf8');
console.log(contents);
}
}
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 oldQuestion = this.questionsList.find(q => q.id === newQuestionId); | |
extendObservable(oldQuestion, newQuestionObject); | |
// via From https://stackoverflow.com/questions/39543194/mobx-replacing-item-in-observable-array/39546605 |
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 didBlurSubscription = this.props.navigation.addListener( | |
'didBlur', | |
payload => { | |
console.debug('didBlur', payload); | |
} | |
); | |
// Remove the listener when you are done | |
didBlurSubscription.remove(); | |
// Payload |
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
import React from 'react'; | |
import {ScrollView, Text} from 'react-native'; | |
const isCloseToBottom = ({layoutMeasurement, contentOffset, contentSize}) => { | |
const paddingToBottom = 20; | |
return layoutMeasurement.height + contentOffset.y >= | |
contentSize.height - paddingToBottom; | |
}; | |
const MyCoolScrollViewComponent = ({enableSomeButton}) => ( |
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
# ignore files locally | |
git update-index --assume-unchanged file | |
# or | |
git update-index --skip-worktree file | |
# to revert | |
git update-index --no-assume-unchanged file | |
git update-index --no-skip-worktree package-lock.json | |
# properly rename caseSensitive folders | |
git mv casesensitive tmp |
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
# try to renew certs every sunday at 02:00 and log the result in /var/log/lets-encrypt-renew.log | |
0 2 * * 7 /opt/certbot/certbot-auto renew --dry-run --pre-hook "nginx service stop" --post-hook "nginx service start" >> /var/log/lets-encrypt-renew.log | |
# renewing manually | |
be sure to enable 80 port, disable all 301/302 redirects in your `.conf` files so letsencrypt can access http challenges |
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
location /static { | |
alias /path/to/static/files; | |
} | |
# via From https://stackoverflow.com/questions/29383159/how-do-you-serve-static-files-from-an-nginx-server-acting-as-a-reverse-proxy-for | |
# or | |
https://medium.com/@jgefroh/a-guide-to-using-nginx-for-static-websites-d96a9d034940 |
git config --global credential.helper "cache --timeout=3600"