Skip to content

Instantly share code, notes, and snippets.

View RichardBray's full-sized avatar
😎
Fix bug , drink milkshake, code feature, repeat.

Richard Oliver Bray RichardBray

😎
Fix bug , drink milkshake, code feature, repeat.
View GitHub Profile
from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop
class HelloHandler(RequestHandler):
def get(self):
self.write({'message': 'hello world'})
def make_app():
urls = [("/", HelloHandler)]
return Application(urls)
from tornado.web import Application, RequestHandler
# application creats app, requesthandler, deals with HTTP requests
from tornado.ioloop import IOLoop
# input output loop used to run async server
from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop
items = []
class TodoItems(RequestHandler):
def get(self):
self.write({'items': items})
from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop
import json
items = []
class TodoItems(RequestHandler):
def get(self):
self.write({'items': items})
[
{
"quote": "As the Father has loved Me, so have I loved you",
"verse": "John 15:9-17 (NIV)",
"desc": "As the Father has loved me, so have I loved you. Now remain in my love. If you keep my commands, you will remain in my love, just as I have kept my Father’s commands and remain in his love. I have told you this so that my joy may be in you and that your joy may be complete. My command is this: Love each other as I have loved you. Greater love has no one than this: to lay down one’s life for one’s friends. 14 You are my friends if you do what I command. I no longer call you servants, because a servant does not know his master’s business. Instead, I have called you friends, for everything that I learned from my Father I have made known to you. You did not choose me, but I chose you and appointed you so that you might go and bear fruit—fruit that will last—and so that whatever you ask in my name the Father will give you. This is my command: Love each other.",
"link": "https://www.desiringgod.
@RichardBray
RichardBray / creat-react-app.md
Last active October 25, 2018 17:23
Your first component from a fresh create react app project
@RichardBray
RichardBray / enzyme_render_diffs.md
Created March 4, 2019 11:41 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@RichardBray
RichardBray / test1.jsx
Last active April 3, 2020 15:52
Enzyme test doc 1 test
// App.jsx
import React, { Fragment } from "react";
// - Data
import data from "./data.json";
export default function App() {
function renderQuestions() {
return data.results.map((result, index) => (
// App.test.js
import React from "react";
import Enzyme, { mount } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import data from "./data.json";
import App from "./App";
Enzyme.configure({ adapter: new Adapter() });
// App.jsx
import React, { Fragment } from "react";
// - Data
import data from "./data.json";
export default function App() {
function renderQuestions() {
return data.results.map((result, index) => (