REST API response format based on some of the best practices
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
| - webpack.config.js | |
| - postcss.config.js | |
| - config.js | |
| - addons.js |
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
| urlpatterns = [ | |
| url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', ConfirmEmailView.as_view(), name='account_confirm_email'), | |
| ] |
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
| let isRefreshing = false; | |
| let refreshSubscribers = []; | |
| const instance = axios.create({ | |
| baseURL: Config.API_URL, | |
| }); | |
| instance.interceptors.response.use(response => { | |
| return response; | |
| }, error => { |
fdisk -l output of these blocks on OnePlus 5
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
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); |
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 EmailMessage class - https://docs.djangoproject.com/en/1.9/topics/email/#django.core.mail.EmailMessage | |
| from django.core.mail import EmailMessage | |
| email = EmailMessage('... Subject ...', '... Body ...', 'from-email', | |
| ['to-email-1', 'to-email-2'], ['bcc-email-1', 'bcc-email-2']) | |
| # now let's create a csv file dynamically | |
| import csv, StringIO | |
| attachment_csv_file = StringIO.StringIO() | |
| writer = csv.writer(attachment_csv_file) |
It sometimes happen you need change code on a machine from which you cannot push to the repo.
You’re ready to copy/paste what diff outputs to your local working copy.
You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:
1. Generate the patch:
git diff > some-changes.patchNewerOlder