I hereby claim:
- I am rockymeza on github.
- I am rockymeza (https://keybase.io/rockymeza) on keybase.
- I have a public key whose fingerprint is 88B0 84DA 0420 C198 E6AA C889 37C5 522F 1DED 379A
To claim this, I am signing this object:
| // web/src/components/FatalErrorBoundary/FatalErrorBoundary.js | |
| import { FatalErrorBoundary as FatalErrorBoundaryBase } from '@redwoodjs/web' | |
| import * as Sentry from '@sentry/browser' | |
| class FatalErrorBoundary extends FatalErrorBoundaryBase { | |
| componentDidCatch(error, errorInfo) { | |
| Sentry.withScope((scope) => { | |
| scope.setExtras(errorInfo) | |
| Sentry.captureException(error) | |
| }) |
| export const withTime = WrappedComponent => props => ( | |
| <GetTime> | |
| {({ currentTime }) => ( | |
| <WrappedComponent | |
| // by passing currentTime first and ...props second, we allow | |
| // parent components to override the currentTime | |
| currentTime={currentTime} | |
| {...props} | |
| /> | |
| )} |
| // We need an impure function that will give us the current time. | |
| // Notice that we return the ISO string version of the date. This is nice | |
| // because it is not a mutable object like `Date` and it is also a | |
| // human readable representation. | |
| const defaultGetTime = () => new Date().toISOString(); | |
| export default class TimeProvider extends React.PureComponent { | |
| static defaultProps = { | |
| interval: 500, | |
| }; |
| const App = () => ( | |
| <TimeProvider> | |
| <h1>My App</h1> | |
| <GetTime> | |
| {({ currentTime }) => <WeekendStatus currentTime={currentTime} />} | |
| </GetTime> | |
| </TimeProvider> | |
| ); |
| import * as React from 'react'; | |
| const WeekendStatus = ({ currentTime }) => { | |
| // Because we take currentTime as a prop, we now no longer depend | |
| // on the external system time in our render function. We are now | |
| // a pure function | |
| const dayOfWeek = new Date(currentTime).getDay(); | |
| const isWeekend = [0, 6].includes(dayOfWeek); | |
| if (isWeekend) { | |
| return <p>It's the weekend!</p>; |
| import * as React from 'react'; | |
| const WeekendStatus = () => { | |
| const dayOfWeek = new Date().getDay(); | |
| const isWeekend = [0, 6].includes(dayOfWeek); | |
| if (isWeekend) { | |
| return <p>It's the weekend!</p>; | |
| } | |
| return <p>It is not the weekend :(</p>; | |
| }; |
| class ComparableModel(object): | |
| """ | |
| Make models comparable based on the Meta.ordering. Usage: | |
| >>> import datetime | |
| >>> class MyModel(ComparableModel, models.Model): | |
| >>> name = models.CharField(max_length=255) | |
| >>> birthdate = models.DateField() | |
| >>> class Meta: | |
| >>> app_label = 'test' |
| // Based on idea from @nolsto | |
| function makeDecorator(decorator) { | |
| return function(target, key, descriptor) { | |
| if (typeof descriptor !== 'undefined') { | |
| descriptor.value = decorator(descriptor.value); | |
| return descriptor | |
| } else { | |
| return decorator(target); | |
| } |
I hereby claim:
To claim this, I am signing this object:
| # /etc/nginx/uwsgi_params | |
| uwsgi_param QUERY_STRING $query_string; | |
| uwsgi_param REQUEST_METHOD $request_method; | |
| uwsgi_param CONTENT_TYPE $content_type; | |
| uwsgi_param CONTENT_LENGTH $content_length; | |
| uwsgi_param REQUEST_URI $request_uri; | |
| uwsgi_param PATH_INFO $document_uri; | |
| uwsgi_param DOCUMENT_ROOT $document_root; |