Skip to content

Instantly share code, notes, and snippets.

Avatar

Ashley Mosuro amosuro

View GitHub Profile
@amosuro
amosuro / 1. BriefTemplate.js
Last active Apr 15, 2019
Brief Templates Model Proposal
View 1. BriefTemplate.js
// This will be the BriefTemplate model which all Briefs will need to use. A BriefTemplate will always reference a 'type' which will be
// how we identify what further fields to use for that particular Brief.
{
type: {
type: String,
enum: ['WEBSITE', 'ANDROID_APP'],
default: 'WEBSITE'
},
status: {
View bbc_arabic.scss
@import '../utils';
.bbc_arabic {
direction: #{map-deep-get($SCRIPT_TYPE_METRICS,BBC_ARABIC,DIRECTION)};
font-family: #{map-deep-get($SCRIPT_TYPE_METRICS,BBC_ARABIC,FONT_FAMILY)};
#content * {
visibility: visible;
}
View server.js
app.use(express.static(path.join(__dirname, 'client', 'build')));
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'client', 'build', 'index.html'));
});
View captions.json
[
{
"captionURL":"./../webcap/index.html",
"startTime":2,
"duration":58,
"captionData":{
"line1":"one",
"caption":"narrative",
"scriptType":"reith",
"legibilityBackground":"none",
View ses9.js
render() {
const {name, email, message} = this.state.fields;
return (
<form ref={this.formElement}
onSubmit={() => this.submitForm()}>
<input type="text"
value={name}
onChange={event => this.onInputChange(event, 'name')}
name="name"
View ses8.js
submitForm() {
const {name, email, message} = this.formElement.current.elements;
const payload = {
url: 'api/contact',
name: name,
email: email,
message: message,
};
post(payload)
View ses7.js
const post = async (data) => {
const { url } = data;
delete data.url;
const params = {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
View ses6.js
// Our end-point for handling the enquiry request
app.post('/api/contact', (req, res, next) => {
return mailer.sendMail('sender@email.com', ['reciever@email.com'], req.body)
.then(() => res.send(req.body))
.catch(next);
});
app.listen(port, () => console.log(`Listening on port ${port}`));
View ses5.js
const app = express();
const port = process.env.PORT || 5000;
AWS.config.update({region: 'eu-west-1'}); // Set the region that you configured in AWS
View ses4.js
const AWS = require('aws-sdk'); // Load the SDK for JavaScript
const mailer = require("./mailer");
const express = require('express');