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
<input onClick={function() {}} /> | |
class Component extends React.Component { | |
propTypes = { | |
onClick: PropTypes.func, | |
} | |
handleClick = e => { | |
// do stuff | |
this.props.onClick() |
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 { doStuff } from "parent"; | |
export handle = (data, context, callback) => { | |
return doStuff(data, context, callback, "custom-arg-1"); | |
} |
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
{ | |
"type": "object", | |
"properties": { | |
"user": { | |
"description": "The user that is selecting her peers", | |
"type": "object", | |
"properties": { | |
"firstName": { | |
"type": "string" | |
}, |
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 flask | |
from flask import redirect, url_for, flash | |
from flask_security import current_user, login_user | |
from flask_dance.consumer import oauth_authorized, oauth_error | |
from flask_dance.consumer.backend.sqla import SQLAlchemyBackend | |
from flask_dance.contrib.github import make_github_blueprint | |
from sqlalchemy.orm.exc import NoResultFound | |
from myapp.models import db, OAuth, User | |
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
# This requires the Requests module, which is a 3rd-party module: python-requests.org | |
# Install with: `pip install requests` | |
import requests | |
def paginated_get(url): | |
""" | |
Create a generator of objects from the GitHub API, | |
while traversing Link headers for pagination. | |
""" | |
response = requests.get(url) |
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
>>> def generator(): | |
... yield 4 | |
... yield 5 | |
... | |
>>> x, y = generator() | |
>>> x | |
4 | |
>>> y | |
5 | |
>>> # mind blown!! |
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
web_1 | [2017-02-27 15:36:06] ERROR 437 [django.request] exception.py:124 - [6a1da3000f19] - Internal Server Error: /api/v0/search/_search | |
web_1 | Traceback (most recent call last): | |
web_1 | File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner | |
web_1 | response = get_response(request) | |
web_1 | File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response | |
web_1 | response = self._get_response(request) | |
web_1 | File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response | |
web_1 | response = self.process_exception_by_middleware(e, request) | |
web_1 | File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response | |
web_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) |
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
$ vagrant init ubuntu/xenial64 | |
A `Vagrantfile` has been placed in this directory. You are now | |
ready to `vagrant up` your first virtual environment! Please read | |
the comments in the Vagrantfile as well as documentation on | |
`vagrantup.com` for more information on using Vagrant. | |
$ vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
==> default: Box 'ubuntu/xenial64' could not be found. Attempting to find and install... | |
default: Box Provider: virtualbox | |
default: Box Version: >= 0 |
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
➜ micromasters git:(master) docker-compose run web ./manage.py seed_db | |
/usr/local/lib/python3.5/site-packages/django/db/models/fields/__init__.py:1430: RuntimeWarning: DateTimeField CourseRun.enrollment_start received a naive datetime (2016-08-15 00:00:00) while time zone support is active. | |
RuntimeWarning) | |
/usr/local/lib/python3.5/site-packages/django/db/models/fields/__init__.py:1430: RuntimeWarning: DateTimeField CourseRun.start_date received a naive datetime (2016-08-15 00:00:00) while time zone support is active. | |
RuntimeWarning) | |
/usr/local/lib/python3.5/site-packages/django/db/models/fields/__init__.py:1430: RuntimeWarning: DateTimeField CourseRun.enrollment_end received a naive datetime (2016-08-29 00:00:00) while time zone support is active. | |
RuntimeWarning) | |
/usr/local/lib/python3.5/site-packages/django/db/models/fields/__init__.py:1430: RuntimeWarning: DateTimeField CourseRun.end_date received a naive datetime (2016-12-15 00:00:00) while time zone support is active. | |
RuntimeWarning) | |
/usr/local |
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
celery_1 | [2017-01-30 16:55:33,110: ERROR/MainProcess] Task search.tasks.index_users[a11ccd3d-b0d4-435a-b3d1-4a80129fbfd0] raised unexpected: DoesNotExist('FinalGrade matching query does not exist.',) | |
celery_1 | Traceback (most recent call last): | |
celery_1 | File "/usr/local/lib/python3.5/site-packages/celery/app/trace.py", line 240, in trace_task | |
celery_1 | R = retval = fun(*args, **kwargs) | |
celery_1 | File "/usr/local/lib/python3.5/site-packages/celery/app/trace.py", line 438, in __protected_call__ | |
celery_1 | return self.run(*args, **kwargs) | |
celery_1 | File "/src/search/tasks.py", line 44, in index_users | |
celery_1 | _index_users(users) | |
celery_1 | File "/src/search/indexing_api.py", line 143, in index_users | |
celery_1 | return index_program_enrolled_users(program_enrollments, chunk_size) |