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
$(cat plot.html) |
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
'use strict'; | |
var http = require('http'); | |
// Handler called on Origin Request event by CloudFront. | |
// Copies the original URI header to a custom header field and rewrites the request to fetch /index.html as the application we are serving is a SPA. | |
module.exports.metaTagOriginRequestRewriter = (event, context, callback) => { | |
const request = event.Records[0].cf.request; | |
request.headers["x-dubsmash-uri"] = [{key: "X-Dubsmash-URI", value: request.uri}]; | |
request.uri = "/index.html"; |
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
'use strict'; | |
var http = require('http'); | |
module.exports.metaTagOriginRequestRewriter = (event, context, callback) => { | |
const request = event.Records[0].cf.request; | |
request.headers["x-dubsmash-uri"] = [{key: "X-Dubsmash-URI", value: request.uri}]; | |
request.uri = "/index.html"; | |
callback(null, request); | |
}; |
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 PropTypes from 'prop-types'; | |
import React from 'react'; | |
import {Pager} from 'react-bootstrap'; | |
import gql from 'graphql-tag'; | |
import {graphql} from 'react-apollo'; | |
const PokemonQuery = gql` | |
query Pokemons($trainerID: Int!, $first: Int, $after: String) { | |
pokemons(trainerID: $trainerID, first: $first, after: $after) { |
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
query Pokemons($trainerID: Int!, $first: Int, $after: String) { | |
pokemons(trainerID: $trainerID, first: $first, after: $after) { | |
edges { | |
cursor | |
node { | |
id | |
name | |
species { | |
name | |
} |
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
query Pokemons($trainerID: Int!, $cursor: String) { | |
pokemons(trainerID: $trainerID, cursor: $cursor) { | |
id | |
name | |
species { | |
name | |
} | |
# ... | |
} | |
} |
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
query Pokemons($trainerID: Int!, $offset: Int, $limit: Int) { | |
pokemons(trainerID: $trainerID, offset: $offset, limit: $limit) { | |
id | |
name | |
species { | |
name | |
} | |
# ... | |
} | |
} |
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
@app.route('/validate', methods=['GET']) | |
def validate(): | |
email = request.args.get('email', '') | |
# Do some basic regex validation first | |
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email) | |
if match == None: | |
abort(400) | |
# Extract the host |