Skip to content

Instantly share code, notes, and snippets.

@saintsGrad15
Last active August 16, 2019 14:40
Show Gist options
  • Select an option

  • Save saintsGrad15/cee8650a57f93a4e7ab4eff4ca57960c to your computer and use it in GitHub Desktop.

Select an option

Save saintsGrad15/cee8650a57f93a4e7ab4eff4ca57960c to your computer and use it in GitHub Desktop.
Python
- A directory that contains a __main__.py file can be executed directly by the python interpreter
- If that directory contains a __init__.py file it can be executed as a module.
- If using MatPlotLib you might receive a "Python was not installed as a framework..." error.
- Create a file `~/.matplotlib/matplotlibrc` and populate it with `backend: TkAgg` to solve the problem.
- Why? Who fuckin knows?
Jupyter
- When installing a Javascript Jupyter kernel following the following page:
- https://github.com/n-riesco/ijavascript
- The steps on that page can apparently only be run with Python 2.
Gunicorn
- Startup command
- gunicorn -w 2 -b localhost:9000 app
- Must create 2+ workers so that resources can be loaded simultaneously
- --log-level only applies to internal error logs
- Set log level in code/with config
- Might be able to use gunicorn's other config to control this
Webservers
- Simplfy API responses
- Content should be simple if even needed
- Status code should be 200, 400, 404 or 500, unless there is another highly compelling option
- Other details should be included in headers to allow maintaining a response API
VueJS
- Mutating parent state from within child components
- Declare a prop on the child
- Map the parent datum to the child prop when instantiating the child component
- `<child-component :child-prop="parentDatum"></child-component>`
- In child template/code
`$emit(some-event, 'the data to pass to event handler') // Data can be arbirarily complex`
- Attach event handler (@some-event) when instantiating the child component
- In event handler mutate parent data (increment, push to array, change value completely, etc.)
- When mutating the value in markup, `$event` represents the value passed as the second argument to `$emit()`
- When mutating the value via a method, the first argument passed to the method will be
the value passed as the second argument to `$emit()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment