Copy and paste this on your list page after you log in.
This file contains 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
// how do I get an error handler function involved here? | |
Routes.forEach(route => { | |
(app as any)[route.method](route.route, (req: Request, res: Response, next: Function) => { | |
const result = (new (route.controller as any))[route.action](req, res, next); | |
if (result instanceof Promise) { | |
result.then(result => result !== null && result !== undefined ? res.send(result) : undefined); | |
} else if (result !== null && result !== undefined) { | |
res.json(result); |
This file contains 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 React from 'react' | |
import { StaticQuery, graphql } from 'gatsby' | |
import Img from 'gatsby-image' | |
export default class RichTextImage extends React.Component { | |
render() { | |
return ( | |
<StaticQuery | |
query={graphql` | |
query { |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Micro Stripe Checkout</title> | |
<meta charSet='utf-8' /> | |
<meta name='viewport' content='initial-scale=1.0, width=device-width' /> | |
<script src="https://js.stripe.com/v3/"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> | |
<style> | |
* { |
This file contains 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
require('dotenv').config(); // we need our dotenv stuff | |
// https://github.com/romuloalves/micro-post/blob/master/src/index.js | |
module.exports = exports = function (fn) { | |
return (req, res) => { | |
res.setHeader('Access-Control-Request-Method', 'POST, GET') | |
res.setHeader("Access-Control-Allow-Credentials", "true"); | |
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"); | |
// set this with your own URL | |
res.setHeader('Access-Control-Allow-Origin', process.env.STRIPE_ALLOW_DOMAIN); |
This file contains 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
require('dotenv').config(); // we need our dotenv stuff | |
const {send, json} = require('micro'); | |
const post = require('./post'); // we'll make this soon don't worry. | |
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY); // this is our stripe key! use your testing key for now. | |
module.exports = post(async (req, res) => { | |
const data = await json(req); | |
stripe.charges.create(data, (err, resp) => { | |
if (err) { |
This file contains 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 Post from './post'; // coming soon, don't worry | |
export default function({ className, data }) { | |
return ( | |
<div className={className}> | |
{data.map(post => ( | |
<Post key={post.id} post={post} /> | |
)) | |
} | |
</div> | |
); |
This file contains 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 React from 'react'; | |
import 'isomorphic-fetch'; | |
import Feed from './components/Feed'; | |
const postEndpoint = `http://twnsndco.dropmark.com/396720.json`; | |
export default class Index extends React.Component { | |
static async getInitialProps () { | |
const response = await fetch(postEndpoint); | |
const json = await response.json(); |
This file contains 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 React, { PropTypes } from 'react'; | |
import moment from 'moment'; | |
export default class Post extends React.Component { | |
constructor (props) { | |
super(props); | |
} | |
render () { | |
const { |
This file contains 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
#include <iostream> | |
using namespace std; | |
struct StudentType | |
{ | |
string name; | |
int score; | |
char grade; | |
}; |
NewerOlder