ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Add PATH to ~/.bash_profile and ~/.zshrc
export PATH=/usr/local/bin:$PATH
Below are a small collection of React examples to get anyone started using React. They progress from simpler to more complex/full featured.
They will hopefully get you over the initial learning curve of the hard parts of React (JSX, props vs. state, lifecycle events, etc).
You will want to create an index.html file and copy/paste the contents of 1-base.html and then create a scripts.js file and copy/paste the contents of one of the examples into it.
| from django.contrib import admin | |
| from polls.models import Poll, Choice | |
| from django.contrib.auth.models import User | |
| from django.contrib.admin import AdminSite | |
| from polls.views import index | |
| class MyAdminSite(AdminSite): |
| import jwt | |
| from django.conf import settings | |
| from django.contrib.auth.models import User | |
| from rest_framework import exceptions | |
| from rest_framework.authentication import TokenAuthentication | |
| class JSONWebTokenAuthentication(TokenAuthentication): |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| #!/bin/bash | |
| # remove exited containers: | |
| docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
| # remove unused images: | |
| docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi | |
| # remove unused volumes: | |
| find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <( |
| from .models import Post, Category | |
| from .decorators import action_form | |
| class PostCategoryForm(forms.Form): | |
| title = 'Update category for the selected posts' | |
| myfile = forms.FileField() | |
| category = forms.ModelChoiceField(queryset=Category.objects.all()) |
| # see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/ | |
| # core | |
| brew install coreutils | |
| # key commands | |
| brew install binutils | |
| brew install diffutils | |
| brew install ed --default-names | |
| brew install findutils --with-default-names |