<commit_before>// @flow strict

import { GraphQLList, GraphQLNonNull } from 'graphql';

import type {
  GraphQLFieldConfig,
  GraphQLInputType,
  GraphQLOutputType,
  GraphQLResolveInfo,
} from 'graphql';

type PluralIdentifyingRootFieldConfig = {|
  argName: string,
  inputType: GraphQLInputType,
  outputType: GraphQLOutputType,
  resolveSingleInput: (
    input: any,
    context: any,
    info: GraphQLResolveInfo,
  ) => ?any,
  description?: ?string,
|};

export function pluralIdentifyingRootField(
  config: PluralIdentifyingRootFieldConfig,
): GraphQLFieldConfig<mixed, mixed> {
  const inputArgs = {};
  let inputType = config.inputType;
  if (inputType instanceof GraphQLNonNull) {
    inputType = inputType.ofType;
  }
  inputArgs[config.argName] = {
    type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(inputType))),
  };
  return {
    description: config.description,
    type: new GraphQLList(config.outputType),
    args: inputArgs,
    resolve(_obj, args, context, info) {
      const inputs = args[config.argName];
      return Promise.all(
        inputs.map((input) =>
          Promise.resolve(config.resolveSingleInput(input, context, info)),
        ),
      );
    },
  };
}
<commit_msg>Use graphql's predicate function instead of `instanceof` (#270)<commit_after>// @flow strict

import { GraphQLList, GraphQLNonNull, isNonNullType } from 'graphql';

import type {
  GraphQLFieldConfig,
  GraphQLInputType,
  GraphQLOutputType,
  GraphQLResolveInfo,
} from 'graphql';

type PluralIdentifyingRootFieldConfig = {|
  argName: string,
  inputType: GraphQLInputType,
  outputType: GraphQLOutputType,
  resolveSingleInput: (
    input: any,
    context: any,
    info: GraphQLResolveInfo,
  ) => ?any,
  description?: ?string,
|};

export function pluralIdentifyingRootField(
  config: PluralIdentifyingRootFieldConfig,
): GraphQLFieldConfig<mixed, mixed> {
  const inputArgs = {};
  let inputType = config.inputType;
  if (isNonNullType(inputType)) {
    inputType = inputType.ofType;
  }
  inputArgs[config.argName] = {
    type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(inputType))),
  };
  return {
    description: config.description,
    type: new GraphQLList(config.outputType),
    args: inputArgs,
    resolve(_obj, args, context, info) {
      const inputs = args[config.argName];
      return Promise.all(
        inputs.map((input) =>
          Promise.resolve(config.resolveSingleInput(input, context, info)),
        ),
      );
    },
  };
}
<|endoftext|>


<commit_before>/**
 * Request handler used in node.js
 */

var request = require('request');

module.exports = function(req, callback){
  request({
    url: req.url,
    method: req.method,
    headers: req.headers,
    body: req.body
  }, function(error, res, body){
    var response;
    if(res){
      response = createResponse(req, res, body);
    }
    setTimeout(function(){
      callback(error, response);
    });
  });
};

/**
 * Convert an node response to a standard sdk response object
 *
 * @param {Object} request {url, method, headers, retries}
 * @param {http.IncomingMessage} response
 * @param {String} body
 * @return {Object} response
 */
function createResponse(request, response, body){
  return {
    statusCode: response.statusCode,
    statusText: response.statusMessage,
    headers: response.headers,
    originalUrl: request.url,
    effectiveUrl: request.url,
    redirected: false,
    requestMethod: request.method,
    requestHeaders: request.headers,
    body: body,
    retries: 0,
    throttled: false
  };
}<commit_msg>disable automatic redirect handling in node request<commit_after>/**
 * Request handler used in node.js
 */

var request = require('request');

module.exports = function(req, callback){
  request({
    url: req.url,
    method: req.method,
    headers: req.headers,
    body: req.body,
    followRedirect: false
  }, function(error, res, body){
    var response;
    if(res){
      response = createResponse(req, res, body);
    }
    setTimeout(function(){
      callback(error, response);
    });
  });
};

/**
 * Convert an node response to a standard sdk response object
 *
 * @param {Object} request {url, method, headers, retries}
 * @param {http.IncomingMessage} response
 * @param {String} body
 * @return {Object} response
 */
function createResponse(request, response, body){
  return {
    statusCode: response.statusCode,
    statusText: response.statusMessage,
    headers: response.headers,
    originalUrl: request.url,
    effectiveUrl: request.url,
    redirected: false,
    requestMethod: request.method,
    requestHeaders: request.headers,
    body: body,
    retries: 0,
    throttled: false
  };
}<|endoftext|>


<commit_before>/* German initialisation for the jQuery UI date picker plugin. */
/* Written by Milian Wolff (mail@milianw.de). */
jQuery(function($){
	$.datepicker.regional['de'] = {
		closeText: 'schließen',
		prevText: '<zurück',
		nextText: 'Vor>',
		currentText: 'heute',
		monthNames: ['Januar','Februar','März','April','Mai','Juni',
		'Juli','August','September','Oktober','November','Dezember'],
		monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
		'Jul','Aug','Sep','Okt','Nov','Dez'],
		dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
		dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		weekHeader: 'KW',
		dateFormat: 'dd.mm.yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['de']);
});
<commit_msg>Datepicker: Updated German locale. Fixes #9098 - Datepicker German localization - make casing of previous/next/today consistent.<commit_after>/* German initialisation for the jQuery UI date picker plugin. */
/* Written by Milian Wolff (mail@milianw.de). */
jQuery(function($){
	$.datepicker.regional['de'] = {
		closeText: 'Schließen',
		prevText: '<Zurück',
		nextText: 'Vor>',
		currentText: 'Heute',
		monthNames: ['Januar','Februar','März','April','Mai','Juni',
		'Juli','August','September','Oktober','November','Dezember'],
		monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
		'Jul','Aug','Sep','Okt','Nov','Dez'],
		dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
		dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		weekHeader: 'KW',
		dateFormat: 'dd.mm.yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['de']);
});
<|endoftext|>


<commit_before>const {binaryToHex} = require('./utils')
const {TransactionRetryNeeded} = require('./errors')
const Uint64 = require('./uint64')
const Ref = require('./ref')

class ObjectCache {
	constructor() {
		this.objects = new Map()
	}

	get(id) {
		const hashable = binaryToHex(id)
		if (!this.objects.has(hashable)) {
			this.objects.set(hashable, new ObjectCacheEntry(id))
		}
		return this.objects.get(hashable)
	}

	remove(id) {
		const hashable = binaryToHex(id)
		if (!this.objects.has(hashable)) {
			throw new Error(`Unexpected remove of id ${hashable}`)
		}
		this.objects.delete(hashable)
	}

	getTemporaryView() {
		return new CopyCache(this)
	}
}

module.exports = ObjectCache

class ObjectCacheEntry {
	constructor(id) {
		if (id instanceof Uint8Array == false) {
			throw new Error("id must be a uint8")
		}
		this.id = id

		this.version = null
		this.data = {
			value: null,
			refs: null
		}

		this.hasBeenWritten = false
		this.hasBeenRead = false
		this.hasBeenCreated = false
	}

	update(version, value, refs) {
		if (value != null && value instanceof ArrayBuffer != true) {
			throw new Error("values should be array buffers : " + value)
		}
		ObjectCacheEntry.checkRefs(refs)
		this.data.value = value
		this.data.refs = refs
		this.version = version
	}

	read() {
		if (!this.hasBeenWritten && !this.hasBeenCreated) {
			this.hasBeenRead = true
		}
		if (this.hasBeenCreated || this.hasBeenWritten || this.version != null) {
			return this.data
		}

		throw new TransactionRetryNeeded(`Object ${this.id} not present in cache`)
	}

	write(value, refs) {
		if (value instanceof ArrayBuffer != true) {
			throw new Error("values should be array buffers : " + value)
		}
		ObjectCacheEntry.checkRefs(refs)
		if (!this.hasBeenCreated) {
			this.hasBeenWritten = true
		}
		this.data.value = value
		this.data.refs = refs
	}

	create(value, refs) {
		if (value instanceof ArrayBuffer != true) {
			throw new Error("values should be array buffers : " + value)
		}
		ObjectCacheEntry.checkRefs(refs)
		this.hasBeenCreated = true
		this.data.value = value
		this.data.refs = refs
	}

	static checkRefs(refs) {
		for (let ref of refs) {
			if (ref instanceof Ref == false) {
				throw new Error("Refs of wrong type")
			}
		}
	}

	clone() {
		const result = new ObjectCacheEntry(this.id)
		result.version = this.version
		result.data.value = this.data.value
		result.data.refs = this.data.refs
		result.hasBeenRead = this.hasBeenRead
		result.hasBeenWritten = this.hasBeenWritten
		result.hasBeenCreated = this.hasBeenCreated
		return result
	}

	toAction(initialVersion) {
		const result = {
			VarId: this.id.buffer,
		}
		const refMessages = this.version ? this.data.refs.map((ref) => ref.toMessage()) : []
		if (this.hasBeenRead && !this.hasBeenWritten) {
			result.Read = {Version: this.version || initialVersion}
		} else if (this.hasBeenWritten && !this.hasBeenRead) {
			result.Write = {Value: this.data.value, References: refMessages}
		} else if (this.hasBeenWritten && this.hasBeenRead) {
			result.ReadWrite = {Version: this.version, Value: this.data.value, References: refMessages}
		} else if (this.hasBeenCreated) {
			result.Create = {Value: this.data.value, References: refMessages}
		} else {
			throw new Error(`No read or write has occurred on object ${this.id}, cannot form an action.`)
		}
		return result
	}
}

class CopyCache {
	constructor(parentCache) {
		this.parentCache = parentCache
		this.objects = new Map()
	}

	get(id) {
		const hashable = binaryToHex(id)
		if (!this.objects.has(hashable)) {
			this.objects.set(hashable, this.parentCache.get(id).clone())
		}
		return this.objects.get(hashable)
	}

	promote(finalTxnId) {
		for (let [, entry] of this.objects) {
			if (entry.hasBeenCreated || entry.hasBeenWritten) {
				this.parentCache.get(entry.id).update(finalTxnId, entry.data.value, entry.data.refs)
			}
		}
	}

	getActions(namespace) {
		const actions = []
		const initialVersion = Uint64.from(0, 0, 0, 0, 0, 0, 0, 0).concat(namespace)

		for (let [,cacheEntry] of this.objects) {
			actions.push(cacheEntry.toAction(initialVersion))
		}

		return actions
	}
}<commit_msg>restrict writing to the result of txn.read<commit_after>const {binaryToHex} = require('./utils')
const {TransactionRetryNeeded} = require('./errors')
const Uint64 = require('./uint64')
const Ref = require('./ref')

class ObjectCache {
	constructor() {
		this.objects = new Map()
	}

	get(id) {
		const hashable = binaryToHex(id)
		if (!this.objects.has(hashable)) {
			this.objects.set(hashable, new ObjectCacheEntry(id))
		}
		return this.objects.get(hashable)
	}

	remove(id) {
		const hashable = binaryToHex(id)
		if (!this.objects.has(hashable)) {
			throw new Error(`Unexpected remove of id ${hashable}`)
		}
		this.objects.delete(hashable)
	}

	getTemporaryView() {
		return new CopyCache(this)
	}
}

module.exports = ObjectCache

class ObjectCacheEntry {
	constructor(id) {
		if (id instanceof Uint8Array == false) {
			throw new Error("id must be a uint8")
		}
		this.id = id

		this.version = null
		this.data = {
			value: null,
			refs: null
		}

		this.readOnlyData = Object.create({}, {
			value: {
				set: () => { throw new Error("Cannot set value without a transaction.write call.") },
				get: () => { return this.data.value }
			},
			refs: {
				set: () => { throw new Error("Cannot set references without a transaction.write call.") },
				get: () => {
					const srcRefs = this.data.refs
					if (global.Proxy) {
						return new Proxy(srcRefs, {set: () => {throw new Error("Cannot change references without a transaction.write call.")}})
					} else {
						return srcRefs.slice()
					}
				}
			}
		})

		this.hasBeenWritten = false
		this.hasBeenRead = false
		this.hasBeenCreated = false
	}

	update(version, value, refs) {
		if (value != null && value instanceof ArrayBuffer != true) {
			throw new Error("values should be array buffers : " + value)
		}
		ObjectCacheEntry.checkRefs(refs)
		this.data.value = value
		this.data.refs = refs
		this.version = version
	}

	read() {
		if (!this.hasBeenWritten && !this.hasBeenCreated) {
			this.hasBeenRead = true
		}
		if (this.hasBeenCreated || this.hasBeenWritten || this.version != null) {
			return this.readOnlyData
		}

		throw new TransactionRetryNeeded(`Object ${this.id} not present in cache`)
	}

	write(value, refs) {
		if (value instanceof ArrayBuffer != true) {
			throw new Error("values should be array buffers : " + value)
		}
		ObjectCacheEntry.checkRefs(refs)
		if (!this.hasBeenCreated) {
			this.hasBeenWritten = true
		}
		this.data.value = value
		this.data.refs = refs
	}

	create(value, refs) {
		if (value instanceof ArrayBuffer != true) {
			throw new Error("values should be array buffers : " + value)
		}
		ObjectCacheEntry.checkRefs(refs)
		this.hasBeenCreated = true
		this.data.value = value
		this.data.refs = refs
	}

	static checkRefs(refs) {
		for (let ref of refs) {
			if (ref instanceof Ref == false) {
				throw new Error("Refs of wrong type")
			}
		}
	}

	clone() {
		const result = new ObjectCacheEntry(this.id)
		result.version = this.version
		result.data.value = this.data.value
		result.data.refs = this.data.refs
		result.hasBeenRead = this.hasBeenRead
		result.hasBeenWritten = this.hasBeenWritten
		result.hasBeenCreated = this.hasBeenCreated
		return result
	}

	toAction(initialVersion) {
		const result = {
			VarId: this.id.buffer,
		}
		const refMessages = this.version ? this.data.refs.map((ref) => ref.toMessage()) : []
		if (this.hasBeenRead && !this.hasBeenWritten) {
			result.Read = {Version: this.version || initialVersion}
		} else if (this.hasBeenWritten && !this.hasBeenRead) {
			result.Write = {Value: this.data.value, References: refMessages}
		} else if (this.hasBeenWritten && this.hasBeenRead) {
			result.ReadWrite = {Version: this.version, Value: this.data.value, References: refMessages}
		} else if (this.hasBeenCreated) {
			result.Create = {Value: this.data.value, References: refMessages}
		} else {
			throw new Error(`No read or write has occurred on object ${this.id}, cannot form an action.`)
		}
		return result
	}
}

class CopyCache {
	constructor(parentCache) {
		this.parentCache = parentCache
		this.objects = new Map()
	}

	get(id) {
		const hashable = binaryToHex(id)
		if (!this.objects.has(hashable)) {
			this.objects.set(hashable, this.parentCache.get(id).clone())
		}
		return this.objects.get(hashable)
	}

	promote(finalTxnId) {
		for (let [, entry] of this.objects) {
			if (entry.hasBeenCreated || entry.hasBeenWritten) {
				this.parentCache.get(entry.id).update(finalTxnId, entry.data.value, entry.data.refs)
			}
		}
	}

	getActions(namespace) {
		const actions = []
		const initialVersion = Uint64.from(0, 0, 0, 0, 0, 0, 0, 0).concat(namespace)

		for (let [,cacheEntry] of this.objects) {
			actions.push(cacheEntry.toAction(initialVersion))
		}

		return actions
	}
}<|endoftext|>


<commit_before>import Inferno from 'inferno'
import Component from 'inferno-component'
import { connect } from 'inferno-mobx'
import TodoAdd from '../components/todos/TodoAdd'
import TodoItem from '../components/todos/TodoItem'

@connect(['todos'])
class Todos extends Component {

    // When route is loaded (isomorphic)
    static onEnter({ todos, common, params }) {
        common.title = 'Home'
        return todos.browse()
    }

    render({ todos }) {
        return

todos

                <TodoAdd/>

                    <TodoItemWrapper todos={todos}/>

    }
}

// Render each item
const TodoItemWrapper = connect(props => {
    return

        {props.todos.map(item => <TodoItem item={item}/>)}

})

export default Todos
<commit_msg>Formatting<commit_after>import Inferno from 'inferno'
import Component from 'inferno-component'
import { connect } from 'inferno-mobx'
import TodoAdd from '../components/todos/TodoAdd'
import TodoItem from '../components/todos/TodoItem'

@connect(['todos'])
class Todos extends Component {

    // When route is loaded (isomorphic)
    static onEnter({ todos, common, params }) {
        common.title = 'Home'
        return todos.browse()
    }

    render({ todos }) {
        return

todos

                <TodoAdd/>

                    <TodoItemWrapper todos={todos}/>

    }
}

// Render each item
const TodoItemWrapper = connect(props => (

        {props.todos.map(item => <TodoItem item={item}/>)}

))

export default Todos
<|endoftext|>


<commit_before>import Inferno from 'inferno'
import Component from 'inferno-component'
import { connect } from 'inferno-mobx'
import TodoAdd from '../components/todos/TodoAdd'
import TodoItem from '../components/todos/TodoItem'

@connect(['todos'])
class Todos extends Component {

    // When route is loaded (isomorphic)
    static onEnter({ todos, common, params }) {
        common.title = 'Home'
        return todos.browse()
    }

    render({ todos }) {
        return

todos

                <TodoAdd/>

                        {todos.map(item => (
                            <TodoItem key={item.text.hashCode()} item={item}/>
                        ))}

    }
}

export default Todos
<commit_msg>Removed key because inferno doesn't use keys<commit_after>import Inferno from 'inferno'
import Component from 'inferno-component'
import { connect } from 'inferno-mobx'
import TodoAdd from '../components/todos/TodoAdd'
import TodoItem from '../components/todos/TodoItem'

@connect(['todos'])
class Todos extends Component {

    // When route is loaded (isomorphic)
    static onEnter({ todos, common, params }) {
        common.title = 'Home'
        return todos.browse()
    }

    render({ todos }) {
        return

todos

                <TodoAdd/>

                    <TodoItemWrapper todos={todos}/>

    }
}

// Render each item
const TodoItemWrapper = connect(props => {
    return

        {props.todos.map(item => <TodoItem item={item}/>)}

})

export default Todos
<|endoftext|>


<commit_before>import React from 'react';
import Link from 'gatsby-link';
import Footer from './components/footer.js'
//import me from './images/me_tonga.png';

const SecondPage = () => (

About

This page is my elevator pitch, web style!

I'm one of those people that likes to try do things differently. I find that I'm always trying to improve my situation but my methods don't always run in the norm.

For example, this year I left university to try out studying online. I thought it would be cheaper, more benefical and maybe even exciting! That's going well.

My goals for life seem to revolve around enjoyment and fullfilment. I'm not one to sacrifice either of those recklessly but I am definitely up for taking opportunities to gain experience and improvements in life.

To note, as hard as I try to keep things simple, the above is, like this website, continually changing. If you have feedback or even want to get in touch please email me.

)

export default SecondPage
<commit_msg>changed 'me.png' pathway from '/me_tonga.png'<commit_after>import React from 'react';
import Link from 'gatsby-link';
import Footer from './components/footer.js'
import me from './images/me_tonga.png';

const SecondPage = () => (

About

This page is my elevator pitch, web style!

I'm one of those people that likes to try do things differently. I find that I'm always trying to improve my situation but my methods don't always run in the norm.

For example, this year I left university to try out studying online. I thought it would be cheaper, more benefical and maybe even exciting! That's going well.

My goals for life seem to revolve around enjoyment and fullfilment. I'm not one to sacrifice either of those recklessly but I am definitely up for taking opportunities to gain experience and improvements in life.

To note, as hard as I try to keep things simple, the above is, like this website, continually changing. If you have feedback or even want to get in touch please email me.

)

export default SecondPage
<|endoftext|>


<commit_before>import React from 'react';
import styled from 'styled-components';
import ProfilePicture from '../assets/images/profilepicture.jpg';

const StyledHome = styled.div`

`;

export default () =>

<commit_msg>add some content here<commit_after>import React from 'react';
import styled from 'styled-components';
import ProfilePicture from '../assets/images/profilepicture.jpg';

const StyledAbout = styled.div`

`;

export default () =>

<|endoftext|>


<commit_before>import React from "react";
import Link from "gatsby-link";
import styled from "styled-components";
import Img from "gatsby-image";
import Center from "../components/center";
import ResponsiveContainer from "../components/responsive-container";
import Inset from "../components/inset";
import Text from "../components/text";
import background from "../../public/static/bg2.jpeg";
import VersandhausWalzLogo from "../../public/static/compressed/versandhaus-walz.png";
import OttoLogo from "../../public/static/compressed/otto.png";
import LudwigMediaLogo from "../../public/static/compressed/ludwigmedia.png";
import BadischerWeinLogo from "../../public/static/compressed/badischer-wein.png";

const customers = [
  {
    src: OttoLogo,
    alt: "Otto (GmbH & CoKG)"
  },
  {
    src: VersandhausWalzLogo,
    alt: "Versandhaus Walz"
  },
  {
    src: LudwigMediaLogo,
    alt: "LUDWIG:media gmbh"
  },
  {
    src: BadischerWeinLogo,
    alt: "Badischer Wein eKfr"
  }
];

const HeroImage = styled.div`
  height: 80vh;
  position: relative;
`;

const HeroDarkener = Center.extend`
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.8);
  flex-grow: 1;
`;

const HeroText = styled.h1`
  font-size: 2.5rem;
  max-width: 600px;
  font-family: Montserrat, sans-serif;
  text-align: center;
`;

const HeroTextHighlicht = styled.span`color: rgb(251, 127, 90);`;

const CustomerContainer = ResponsiveContainer.extend`
  display: flex;
  align-items: center;
  flex-direction: column;
  @media (min-width: 700px) {
    flex-direction: row;
  }
`;

const CustomerList = Center.extend`
  padding: 32px 0;
  background-color: hsla(13, 5%, 90%, 1);
`;

const CustomerLogo = styled.div`
  flex: 1 1 auto;
  filter: grayscale(100%);
  max-height: 60px;
  margin: 10px;
  transition: all 0.5s ease-in-out;

  > img {
    max-width: 100%;
    max-height: 100%;
  }
`;

const H2 = styled.h2`
  color: rgb(251, 127, 90);
  margin: 0 0 24px;
`;
const H4 = styled.h4`
  color: rgb(81, 84, 88);
  margin: 0 0 16px;
`;

const SkillGrid = styled.div`
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 16px;
  @media (min-width: 700px) {
    grid-template-columns: 1fr 1fr;
  }
`;

const ServiceSection = styled.div`
  background-color: hsla(13, 10%, 97%, 1);
  padding: 32px 0;
`;

const Skill = styled.div`
  background-color: white;
  border-radius: 4px;

  display: flex;
  flex-direction: column;

  text-align: left;
  color: rgb(118, 122, 129);
  animation: fadein 2s;
`;

const SkillImage = styled.div`
  height: 150px;
  background-color: #ffe6df;
  border-radius: 4px 4px 0 0;
`;

const IndexPage = ({ data }) =>

    <HeroImage>

      <HeroDarkener>
        <HeroText>
          Wir liefern digitale Lösungen,{" "}
          <HeroTextHighlicht>die unsere Kunden lieben.</HeroTextHighlicht>
        </HeroText>
      </HeroDarkener>
    </HeroImage>
    <CustomerList>
      <CustomerContainer>
        {customers.map(logo =>
          <CustomerLogo key={logo.alt}>

          </CustomerLogo>
        )}
      </CustomerContainer>
    </CustomerList>
    <ServiceSection>
      <ResponsiveContainer>

Unsere Leistungen

        <SkillGrid>
          {data.allContentfulServices.edges.map(({ node }) =>
            <Skill key={node.id}>
              <SkillImage />
              <Inset scale="xl">

                  {node.title}

                <Text.Detail>

                </Text.Detail>
              </Inset>
            </Skill>
          )}
        </SkillGrid>
      </ResponsiveContainer>
    </ServiceSection>

;

export default IndexPage;

export const query = graphql`
  query AllServices {
    allContentfulServices {
      edges {
        node {
          id
          title
          description {
            childMarkdownRemark {
              html
            }
          }
        }
      }
    }
    contentfulAsset(title: { eq: "Hero" }) {
      sizes(maxHeight: 1000) {
        ...GatsbyContentfulSizes
      }
    }
  }
`;
<commit_msg>add service images<commit_after>import React from "react";
import Link from "gatsby-link";
import styled from "styled-components";
import Img from "gatsby-image";
import Center from "../components/center";
import ResponsiveContainer from "../components/responsive-container";
import Inset from "../components/inset";
import Text from "../components/text";
import background from "../../public/static/bg2.jpeg";
import VersandhausWalzLogo from "../../public/static/compressed/versandhaus-walz.png";
import OttoLogo from "../../public/static/compressed/otto.png";
import LudwigMediaLogo from "../../public/static/compressed/ludwigmedia.png";
import BadischerWeinLogo from "../../public/static/compressed/badischer-wein.png";

const customers = [
  {
    src: OttoLogo,
    alt: "Otto (GmbH & CoKG)"
  },
  {
    src: VersandhausWalzLogo,
    alt: "Versandhaus Walz"
  },
  {
    src: LudwigMediaLogo,
    alt: "LUDWIG:media gmbh"
  },
  {
    src: BadischerWeinLogo,
    alt: "Badischer Wein eKfr"
  }
];

const HeroImage = styled.div`
  height: 80vh;
  position: relative;
`;

const HeroDarkener = Center.extend`
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.8);
  flex-grow: 1;
`;

const HeroText = styled.h1`
  font-size: 2.5rem;
  max-width: 600px;
  font-family: Montserrat, sans-serif;
  text-align: center;
`;

const HeroTextHighlicht = styled.span`color: rgb(251, 127, 90);`;

const CustomerContainer = ResponsiveContainer.extend`
  display: flex;
  align-items: center;
  flex-direction: column;
  @media (min-width: 700px) {
    flex-direction: row;
  }
`;

const CustomerList = Center.extend`
  padding: 32px 0;
  background-color: hsla(13, 5%, 90%, 1);
`;

const CustomerLogo = styled.div`
  flex: 1 1 auto;
  filter: grayscale(100%);
  max-height: 60px;
  margin: 10px;
  transition: all 0.5s ease-in-out;

  > img {
    max-width: 100%;
    max-height: 100%;
  }
`;

const H2 = styled.h2`
  color: rgb(251, 127, 90);
  margin: 0 0 24px;
`;
const H4 = styled.h4`
  color: rgb(81, 84, 88);
  margin: 0 0 16px;
`;

const SkillGrid = styled.div`
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 16px;
  @media (min-width: 700px) {
    grid-template-columns: 1fr 1fr;
  }
`;

const ServiceSection = styled.div`
  background-color: hsla(13, 10%, 97%, 1);
  padding: 32px 0;
`;

const Skill = styled.div`
  background-color: white;
  border-radius: 4px;

  display: flex;
  flex-direction: column;

  text-align: left;
  color: rgb(118, 122, 129);
  animation: fadein 2s;
`;

const SkillImage = styled.div`
  max-height: 175px;
  background-color: #ffe6df;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
`;

const IndexPage = ({ data }) =>

    <HeroImage>

      <HeroDarkener>
        <HeroText>
          Wir liefern digitale Lösungen,{" "}
          <HeroTextHighlicht>die unsere Kunden lieben.</HeroTextHighlicht>
        </HeroText>
      </HeroDarkener>
    </HeroImage>
    <CustomerList>
      <CustomerContainer>
        {customers.map(logo =>
          <CustomerLogo key={logo.alt}>

          </CustomerLogo>
        )}
      </CustomerContainer>
    </CustomerList>
    <ServiceSection>
      <ResponsiveContainer>

Unsere Leistungen

        <SkillGrid>
          {data.allContentfulServices.edges.map(({ node }) =>
            <Skill key={node.id}>
              <SkillImage>
                {node.image && }
              </SkillImage>
              <Inset scale="xl">

                  {node.title}

                <Text.Detail>

                </Text.Detail>
              </Inset>
            </Skill>
          )}
        </SkillGrid>
      </ResponsiveContainer>
    </ServiceSection>

;

export default IndexPage;

export const query = graphql`
  query AllServices {
    allContentfulServices {
      edges {
        node {
          id
          title
          description {
            childMarkdownRemark {
              html
            }
          }
          image {
            sizes(maxWidth: 426) {
              ...GatsbyContentfulSizes
            }
          }
        }
      }
    }
    contentfulAsset(title: { eq: "Hero" }) {
      sizes(maxHeight: 1000) {
        ...GatsbyContentfulSizes
      }
    }
  }
`;
<|endoftext|>


<commit_before>import Img from 'gatsby-image'
import Link from 'gatsby-link'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import ContactBox from '../components/Contact'

export class IndexPageTemplate extends Component {
  backgroundImageStyle = {
    position: 'absolute',
    left: 0,
    top: 0,
    width: '100%',
    height: '100%'
  }

  render() {
    const {
      headerImage,
      headerText,
      headerSubtext,
      servicesList,
      statsBackground,
      statsList,
      certifications,
      contactInfo,
      servicesHeader,
      whoList,
      whoHeader
    } = this.props

    return (

          {headerImage.childImageSharp && (

          )}

{headerText}

{headerSubtext}

            <Link
              to="/services"
              className="db bg-blue white pv2 ph4 f4 tc f3-ns mw6 center hover-gold hover-shadow fw7"
            >
              Check Out The Work We Do
            </Link>

{servicesHeader}

            {servicesList.map((service, i) => (
              <Link
                to={service.serviceLink}
                className="work-type db mh5 mv4 tc hover-shadow"
                key={i}
              >

                      {service.name}

              </Link>
            ))}

          {statsBackground.childImageSharp && (

          )}

              {statsList.map((stat, i) => (

{stat.statNum}

{stat.label}

              ))}

{whoHeader}

            {whoList.map((client, i) => (
              <Link
                to={client.whoLink}
                className="work-type db mh5 mv4 tc hover-shadow"
                key={i}
              >

                    <i
                      className={`fa fa-beer f-6 dib transparent z-2 relative`}
                    />

                      {client.name}

              </Link>
            ))}

Certifications

              {certifications.map((cert, i) => (
                <Link
                  to={`/certifications#${cert.certId}`}
                  key={i}
                  className="image-container flex items-center justify-center"
                >

                </Link>
              ))}

        {contactInfo && (

Contact Us

              <ContactBox
                street1={contactInfo.address.street1}
                street2={contactInfo.address.street2}
                city={contactInfo.address.city}
                state={contactInfo.address.state}
                zip={contactInfo.address.zip}
                email={contactInfo.email}
                phone={contactInfo.phone}
              />

        )}

    )
  }
}

IndexPageTemplate.propTypes = {
  headerImage: PropTypes.object,
  headerText: PropTypes.string,
  headerSubtext: PropTypes.string,
  servicesList: PropTypes.array,
  statsBackground: PropTypes.object,
  statsList: PropTypes.array,
  certifications: PropTypes.array,
  contactInfo: PropTypes.object,
  servicesHeader: PropTypes.string,
  whoList: PropTypes.array,
  whoHeader: PropTypes.string
}

const IndexPage = ({ data }) => {
  const {
    certifications,
    headerImage,
    headerText,
    headerSubtext,
    servicesList,
    statsBackground,
    statsList,
    servicesHeader,
    whoList,
    whoHeader
  } = data.markdownRemark.frontmatter
  const settingsEdge = data.allMarkdownRemark.edges.find(
    edge => edge.node.frontmatter.templateKey === 'settings'
  )

  return (
    <IndexPageTemplate
      headerImage={headerImage}
      headerText={headerText}
      headerSubtext={headerSubtext}
      servicesList={servicesList}
      statsBackground={statsBackground}
      statsList={statsList}
      certifications={certifications}
      contactInfo={settingsEdge.node.frontmatter}
      servicesHeader={servicesHeader}
      whoList={whoList}
      whoHeader={whoHeader}
    />
  )
}

IndexPage.propTypes = {
  data: PropTypes.shape({
    markdownRemark: PropTypes.shape({
      edges: PropTypes.array
    })
  })
}

export default IndexPage

export const indexPageQuery = graphql`
  query IndexPage {
    ...ContactDetails
    markdownRemark(frontmatter: { templateKey: { eq: "home-page" } }) {
      frontmatter {
        headerImage {
          childImageSharp {
            sizes(maxWidth: 1400) {
              ...GatsbyImageSharpSizes
            }
          }
        }
        headerText
        headerSubtext
        servicesHeader
        servicesList {
          icon
          name
          serviceLink
          background {
            childImageSharp {
              sizes(maxWidth: 300) {
                ...GatsbyImageSharpSizes
              }
            }
          }
        }
        statsBackground {
          childImageSharp {
            sizes(maxWidth: 1400) {
              ...GatsbyImageSharpSizes
            }
          }
        }
        statsList {
          statNum
          label
        }
        whoHeader
        whoList {
          name
          whoLink
          background {
            childImageSharp {
              sizes(maxWidth: 300) {
                ...GatsbyImageSharpSizes
              }
            }
          }
        }
        certifications {
          certImage {
            childImageSharp {
              resolutions(width: 200) {
                ...GatsbyImageSharpResolutions
              }
            }
          }
          description
          certId
        }
      }
    }
  }
`
<commit_msg>Makes header font bigger<commit_after>import Img from 'gatsby-image'
import Link from 'gatsby-link'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import ContactBox from '../components/Contact'

export class IndexPageTemplate extends Component {
  backgroundImageStyle = {
    position: 'absolute',
    left: 0,
    top: 0,
    width: '100%',
    height: '100%'
  }

  render() {
    const {
      headerImage,
      headerText,
      headerSubtext,
      servicesList,
      statsBackground,
      statsList,
      certifications,
      contactInfo,
      servicesHeader,
      whoList,
      whoHeader
    } = this.props

    return (

          {headerImage.childImageSharp && (

          )}

{headerText}

{headerSubtext}

            <Link
              to="/services"
              className="db bg-blue white pv2 ph4 f4 tc f3-ns mw6 center hover-gold hover-shadow fw7"
            >
              Check Out The Work We Do
            </Link>

{servicesHeader}

            {servicesList.map((service, i) => (
              <Link
                to={service.serviceLink}
                className="work-type db mh5 mv4 tc hover-shadow"
                key={i}
              >

                      {service.name}

              </Link>
            ))}

          {statsBackground.childImageSharp && (

          )}

              {statsList.map((stat, i) => (

{stat.statNum}

{stat.label}

              ))}

{whoHeader}

            {whoList.map((client, i) => (
              <Link
                to={client.whoLink}
                className="work-type db mh5 mv4 tc hover-shadow"
                key={i}
              >

                    <i
                      className={`fa fa-beer f-6 dib transparent z-2 relative`}
                    />

                      {client.name}

              </Link>
            ))}

Certifications

              {certifications.map((cert, i) => (
                <Link
                  to={`/certifications#${cert.certId}`}
                  key={i}
                  className="image-container flex items-center justify-center"
                >

                </Link>
              ))}

        {contactInfo && (

Contact Us

              <ContactBox
                street1={contactInfo.address.street1}
                street2={contactInfo.address.street2}
                city={contactInfo.address.city}
                state={contactInfo.address.state}
                zip={contactInfo.address.zip}
                email={contactInfo.email}
                phone={contactInfo.phone}
              />

        )}

    )
  }
}

IndexPageTemplate.propTypes = {
  headerImage: PropTypes.object,
  headerText: PropTypes.string,
  headerSubtext: PropTypes.string,
  servicesList: PropTypes.array,
  statsBackground: PropTypes.object,
  statsList: PropTypes.array,
  certifications: PropTypes.array,
  contactInfo: PropTypes.object,
  servicesHeader: PropTypes.string,
  whoList: PropTypes.array,
  whoHeader: PropTypes.string
}

const IndexPage = ({ data }) => {
  const {
    certifications,
    headerImage,
    headerText,
    headerSubtext,
    servicesList,
    statsBackground,
    statsList,
    servicesHeader,
    whoList,
    whoHeader
  } = data.markdownRemark.frontmatter
  const settingsEdge = data.allMarkdownRemark.edges.find(
    edge => edge.node.frontmatter.templateKey === 'settings'
  )

  return (
    <IndexPageTemplate
      headerImage={headerImage}
      headerText={headerText}
      headerSubtext={headerSubtext}
      servicesList={servicesList}
      statsBackground={statsBackground}
      statsList={statsList}
      certifications={certifications}
      contactInfo={settingsEdge.node.frontmatter}
      servicesHeader={servicesHeader}
      whoList={whoList}
      whoHeader={whoHeader}
    />
  )
}

IndexPage.propTypes = {
  data: PropTypes.shape({
    markdownRemark: PropTypes.shape({
      edges: PropTypes.array
    })
  })
}

export default IndexPage

export const indexPageQuery = graphql`
  query IndexPage {
    ...ContactDetails
    markdownRemark(frontmatter: { templateKey: { eq: "home-page" } }) {
      frontmatter {
        headerImage {
          childImageSharp {
            sizes(maxWidth: 1400) {
              ...GatsbyImageSharpSizes
            }
          }
        }
        headerText
        headerSubtext
        servicesHeader
        servicesList {
          icon
          name
          serviceLink
          background {
            childImageSharp {
              sizes(maxWidth: 300) {
                ...GatsbyImageSharpSizes
              }
            }
          }
        }
        statsBackground {
          childImageSharp {
            sizes(maxWidth: 1400) {
              ...GatsbyImageSharpSizes
            }
          }
        }
        statsList {
          statNum
          label
        }
        whoHeader
        whoList {
          name
          whoLink
          background {
            childImageSharp {
              sizes(maxWidth: 300) {
                ...GatsbyImageSharpSizes
              }
            }
          }
        }
        certifications {
          certImage {
            childImageSharp {
              resolutions(width: 200) {
                ...GatsbyImageSharpResolutions
              }
            }
          }
          description
          certId
        }
      }
    }
  }
`
<|endoftext|>


<commit_before>import React, { useState, useEffect } from "react"
import { Link, graphql } from "gatsby"

import Bio from "../components/bio"
import Layout from "../components/layout"
import SEO from "../components/seo"
import { rhythm } from "../utils/typography"

function BlogIndex({ data , location }) {
  const [tags, setTags] = useState([])
  const [activeTag, setActiveTag] = useState(null)

  // effect hook to set get all tags for the filter bar
  useEffect(() => {
    const posts = data.allMarkdownRemark.edges
    const allTags = posts.map(({ node }) => node.frontmatter.tags).flat();
    setTags(allTags)
  },[])

  function handleTagFilter(tag) {
    if (activeTag && activeTag === tag) {
      setActiveTag(null)
    } else {
      setActiveTag(tag)
    }
  }

  const siteTitle = data.site.siteMetadata.title
  const posts = data.allMarkdownRemark.edges
  return (
    <Layout location={location} title={siteTitle}>
      <SEO title="All posts" />
      <Bio />

        {tags.map(i => (

            <button
              type="button"
              onClick={() => handleTagFilter(i)}
              style={{
                background: 'none',
                boxShadow: i===activeTag ? '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)': null,
                fontSize: i===activeTag ? '1.1rem' : null
              }}
            >
              {i}
            </button>

        ))}

      {posts
      .filter(({ node }) => activeTag ? node.frontmatter.tags.includes(activeTag) : true)
      .map(({ node }) => {
        const title = node.frontmatter.title || node.fields.slug
        return (

                <Link style={{ boxShadow: `none` }} to={node.fields.slug}>
                  {title}
                </Link>

              <p
                style={{
                  display: `flex`,
                  justifyContent: 'space-between',
                }}
              >
                {node.frontmatter.date}
                {node.frontmatter.tags}

        )
      })}
    </Layout>
  )
}

export default BlogIndex

export const pageQuery = graphql`
  query {
    site {
      siteMetadata {
        title
      }
    }
    allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
      edges {
        node {
          excerpt
          fields {
            slug
          }
          frontmatter {
            date(formatString: "MMMM DD, YYYY")
            title
            description
            tags
          }
        }
      }
    }
  }
`
<commit_msg>Add filter button shading<commit_after>import React, { useState, useEffect } from "react"
import { Link, graphql } from "gatsby"

import Bio from "../components/bio"
import Layout from "../components/layout"
import SEO from "../components/seo"
import { rhythm } from "../utils/typography"

function BlogIndex({ data , location }) {
  const [tags, setTags] = useState([])
  const [activeTag, setActiveTag] = useState(null)

  // effect hook to set get all tags for the filter bar
  useEffect(() => {
    const posts = data.allMarkdownRemark.edges
    const allTags = posts.map(({ node }) => node.frontmatter.tags).flat();
    setTags(allTags)
  },[data.allMarkdownRemark.edges])

  function handleTagFilter(tag) {
    if (activeTag && activeTag === tag) {
      setActiveTag(null)
    } else {
      setActiveTag(tag)
    }
  }

  const siteTitle = data.site.siteMetadata.title
  const posts = data.allMarkdownRemark.edges
  return (
    <Layout location={location} title={siteTitle}>
      <SEO title="All posts" />
      <Bio />

        {tags.map(i => (

            <button
              type="button"
              onClick={() => handleTagFilter(i)}
              style={{
                background: 'none',
                boxShadow: i===activeTag ? '0 2px 3px rgba(0,0,0,0.12), 0 2px 2px rgba(0,0,0,0.24)': null,
                fontWeight: i===activeTag ? 700 : null
              }}
            >
              {i}
            </button>

        ))}

      {posts
      .filter(({ node }) => activeTag ? node.frontmatter.tags.includes(activeTag) : true)
      .map(({ node }) => {
        const title = node.frontmatter.title || node.fields.slug
        return (

                <Link style={{ boxShadow: `none` }} to={node.fields.slug}>
                  {title}
                </Link>

              <p
                style={{
                  display: `flex`,
                  justifyContent: 'space-between',
                }}
              >
                {node.frontmatter.date}
                {node.frontmatter.tags}

        )
      })}
    </Layout>
  )
}

export default BlogIndex

export const pageQuery = graphql`
  query {
    site {
      siteMetadata {
        title
      }
    }
    allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) {
      edges {
        node {
          excerpt
          fields {
            slug
          }
          frontmatter {
            date(formatString: "MMMM DD, YYYY")
            title
            description
            tags
          }
        }
      }
    }
  }
`
<|endoftext|>


<commit_before>import { graphql } from 'gatsby'
import _ from 'lodash'
import React, { useEffect } from 'react'
import { Bio } from '../components/bio'
import { Category } from '../components/category'
import { Contents } from '../components/contents'
import { Head } from '../components/head'
import { HOME_TITLE } from '../constants'
import { useCategory } from '../hooks/useCategory'
import { useIntersectionObserver } from '../hooks/useIntersectionObserver'
import { useRenderedCount } from '../hooks/useRenderedCount'
import { Layout } from '../layout'
import * as Dom from '../utils/dom'
import * as EventManager from '../utils/event-manager'

const BASE_LINE = 80

function getDistance(currentPos) {
  return Dom.getDocumentHeight() - currentPos
}

export default ({ data, location }) => {
  const { siteMetadata } = data.site
  const { countOfInitialPost } = siteMetadata.configs
  const posts = data.allMarkdownRemark.edges
  const categories = _.uniq(posts.map(({ node }) => node.frontmatter.category))

  useEffect(() => {
    window.addEventListener(`scroll`, onScroll, { passive: false })
    return () => {
      window.removeEventListener(`scroll`, onScroll, { passive: false })
    }
  }, [])

  const [count, countRef, increaseCount] = useRenderedCount()
  const [category, selectCategory] = useCategory()
  useIntersectionObserver()

  const onScroll = () => {
    const currentPos = window.scrollY + window.innerHeight
    const isTriggerPos = () => getDistance(currentPos) < BASE_LINE
    const doesNeedMore = () =>
      posts.length > countRef.current * countOfInitialPost

    return EventManager.toFit(increaseCount, {
      dismissCondition: () => !isTriggerPos(),
      triggerCondition: () => isTriggerPos() && doesNeedMore(),
    })()
  }

  return (
    <Layout location={location} title={siteMetadata.title}>
      <Head title={HOME_TITLE} keywords={siteMetadata.keywords} />
      <Bio />
      <Category
        categories={categories}
        category={category}
        selectCategory={selectCategory}
      />
      <Contents
        posts={posts}
        countOfInitialPost={countOfInitialPost}
        count={count}
        category={category}
      />
    </Layout>
  )
}

export const pageQuery = graphql`
  query {
    site {
      siteMetadata {
        title
        configs {
          countOfInitialPost
        }
      }
    }
    allMarkdownRemark(
      sort: { fields: [frontmatter___date], order: DESC }
      filter: { frontmatter: { category: { ne: null }, draft: { eq: false } } }
    ) {
      edges {
        node {
          excerpt(pruneLength: 200, truncate: true)
          fields {
            slug
          }
          frontmatter {
            date(formatString: "MMMM DD, YYYY")
            title
            category
            draft
          }
        }
      }
    }
  }
`
<commit_msg>fix: Arrange code<commit_after>import { graphql } from 'gatsby'
import _ from 'lodash'
import React, { useEffect } from 'react'
import { Bio } from '../components/bio'
import { Category } from '../components/category'
import { Contents } from '../components/contents'
import { Head } from '../components/head'
import { HOME_TITLE } from '../constants'
import { useCategory } from '../hooks/useCategory'
import { useIntersectionObserver } from '../hooks/useIntersectionObserver'
import { useRenderedCount } from '../hooks/useRenderedCount'
import { Layout } from '../layout'
import * as Dom from '../utils/dom'
import * as EventManager from '../utils/event-manager'

const BASE_LINE = 80

function getDistance(currentPos) {
  return Dom.getDocumentHeight() - currentPos
}

export default ({ data, location }) => {
  const { siteMetadata } = data.site
  const { countOfInitialPost } = siteMetadata.configs
  const posts = data.allMarkdownRemark.edges
  const categories = _.uniq(posts.map(({ node }) => node.frontmatter.category))
  const [count, countRef, increaseCount] = useRenderedCount()
  const [category, selectCategory] = useCategory()
  useIntersectionObserver()

  useEffect(() => {
    window.addEventListener(`scroll`, onScroll, { passive: false })
    return () => {
      window.removeEventListener(`scroll`, onScroll, { passive: false })
    }
  }, [])

  const onScroll = () => {
    const currentPos = window.scrollY + window.innerHeight
    const isTriggerPos = () => getDistance(currentPos) < BASE_LINE
    const doesNeedMore = () =>
      posts.length > countRef.current * countOfInitialPost

    return EventManager.toFit(increaseCount, {
      dismissCondition: () => !isTriggerPos(),
      triggerCondition: () => isTriggerPos() && doesNeedMore(),
    })()
  }

  return (
    <Layout location={location} title={siteMetadata.title}>
      <Head title={HOME_TITLE} keywords={siteMetadata.keywords} />
      <Bio />
      <Category
        categories={categories}
        category={category}
        selectCategory={selectCategory}
      />
      <Contents
        posts={posts}
        countOfInitialPost={countOfInitialPost}
        count={count}
        category={category}
      />
    </Layout>
  )
}

export const pageQuery = graphql`
  query {
    site {
      siteMetadata {
        title
        configs {
          countOfInitialPost
        }
      }
    }
    allMarkdownRemark(
      sort: { fields: [frontmatter___date], order: DESC }
      filter: { frontmatter: { category: { ne: null }, draft: { eq: false } } }
    ) {
      edges {
        node {
          excerpt(pruneLength: 200, truncate: true)
          fields {
            slug
          }
          frontmatter {
            date(formatString: "MMMM DD, YYYY")
            title
            category
            draft
          }
        }
      }
    }
  }
`
<|endoftext|>


<commit_before>import React from "react"
import Link from "gatsby-link"
import Helmet from "react-helmet"
import css from "./index.module.css"

const H1 = ({children}) =>

{children}

const H2 = ({children}) =>

{children}

const Div = ({children}) =>

{children}

export default () =>

	<Helmet title="man azdavis"/>

NAME

azdavis - a fella

SYNOPSIS

		azdavis (
			<Link to="resume/">resume</Link> {"| "}
			<Link to="posts/">posts</Link> {"| "}
			<Link to="projects/">projects</Link>
		)

DESCRIPTION

		azdavis is pursuing a major in computer science, with a minor in
		Japanese studies, from Carnegie Mellon University.

AUTHORS

Written by David and Karen Davis.

COPYRIGHT

Copyright 1998 Ariel Davis.

<commit_msg>put a 'commands' section to link to sub-pages<commit_after>import React from "react"
import Link from "gatsby-link"
import Helmet from "react-helmet"
import css from "./index.module.css"

const H1 = ({children}) =>

{children}

const H2 = ({children}) =>

{children}

const Div = ({children}) =>

{children}

export default () =>

	<Helmet title="man azdavis"/>

NAME

azdavis - a fella

SYNOPSIS

		azdavis <command>

DESCRIPTION

		azdavis is pursuing a major in computer science, with a minor in
		Japanese studies, from Carnegie Mellon University.

COMMANDS

<Link to="/posts/">Posts</Link>

An assortment of thoughts.

<Link to="/profiles/">Profiles</Link>

A collection of accounts.

<Link to="/projects/">Projects</Link>

An assemblage of works.

<Link to="/resume/">Resume</Link>

A discussion of qualifications.

AUTHORS

Written by David and Karen Davis.

COPYRIGHT

Copyright 1998 Ariel Davis.

<|endoftext|>


<commit_before>/**
 * Copyright (C) 2014 Glayzzle (BSD3 License)
 * @authors https://github.com/glayzzle/php-parser/graphs/contributors
 * @url http://glayzzle.com
 */

module.exports = function(api, tokens, EOF) {
  return {

    read_expr: function() {
      var expr = this.read_expr_item();
      switch(this.token) {
        // binary operations
        case '|': return ['bin', '|', expr, this.next().read_expr()];
        case '&': return ['bin', '&', expr, this.next().read_expr()];
        case '^': return ['bin', '^', expr, this.next().read_expr()];
        case '.': return ['bin', '.', expr, this.next().read_expr()];
        case '+': return ['bin', '+', expr, this.next().read_expr()];
        case '-': return ['bin', '-', expr, this.next().read_expr()];
        case '*': return ['bin', '*', expr, this.next().read_expr()];
        case '/': return ['bin', '/', expr, this.next().read_expr()];
        case '%': return ['bin', '%', expr, this.next().read_expr()];
        case tokens.T_POW:  return ['bin', '**', expr, this.next().read_expr()];
        case tokens.T_SL:   return ['bin', '<<', expr, this.next().read_expr()];
        case tokens.T_SR:   return ['bin', '>>', expr, this.next().read_expr()];

        // boolean operations
        case tokens.T_BOOLEAN_OR:
        case tokens.T_LOGICAL_OR:   return ['bool', '|', expr, this.next().read_expr()];

        case tokens.T_BOOLEAN_AND:
        case tokens.T_LOGICAL_AND:  return ['bool', '&', expr, this.next().read_expr()];

        case tokens.T_LOGICAL_XOR:      return ['bool', '^', expr, this.next().read_expr()];
        case tokens.T_IS_IDENTICAL:     return ['bool', '=', expr, this.next().read_expr()];
        case tokens.T_IS_NOT_IDENTICAL: return ['bool', '!=', expr, this.next().read_expr()];
        case tokens.T_IS_EQUAL:         return ['bool', '~', expr, this.next().read_expr()];
        case tokens.T_IS_NOT_EQUAL:     return ['bool', '!~', expr, this.next().read_expr()];
        case '<':                       return ['bool', '<', expr, this.next().read_expr()];
        case '>':                       return ['bool', '>', expr, this.next().read_expr()];

        case tokens.T_IS_SMALLER_OR_EQUAL:  return ['bool', '<=', expr, this.next().read_expr()];
        case tokens.T_IS_GREATER_OR_EQUAL:  return ['bool', '>=', expr, this.next().read_expr()];
        case tokens.T_INSTANCEOF:           return ['bool', '?', expr, this.next().read_expr()];

        // extra operations :
        case tokens.T_COALESCE: // php7 : $username = $_GET['user'] ?? 'nobody';
          return ['retif', ['sys', 'isset', expr], expr, this.next().read_expr()];
        case '?':
          var trueArg = null;
          if (this.next().token !== ':') {
            trueArg = this.read_expr();
          }
          this.expect(':').next();
          return ['retif', expr, trueArg, this.read_expr()];
      }
      return expr;
    }

    /**
     * <ebnf>
     * Reads an expression
     *  expr ::= @todo
     * </ebnf>
     */
    ,read_expr_item: function() {

      switch(this.token) {

        case '@':
          return ['silence', this.next().read_expr()];

        case '-':
        case '+':
        case '!':
        case '~':
          return ['unary', this.token, this.next().read_expr()];

        case '(':
          var expr = this.next().read_expr();
          this.expect(')').next();
          return expr;

        case '`':
          var expr = null;
          if (this.next().token === tokens.T_ENCAPSED_AND_WHITESPACE) {
            expr = this.text();
            this.next().expect('`').next();
          } else if (this.token !== '`' ) {
            expr = this.read_encaps_list();
          }
          return ['sys', 'shell', expr];

        case tokens.T_LIST:
          return this.read_assignment_list();

        case tokens.T_CLONE:
          return ['sys', 'clone', this.next().read_expr()];

        case tokens.T_INC:
          var name = this.next().read_variable();
          return ['set', name, ['bin', '+', name, ['number', 1]]];

        case tokens.T_DEC:
          var name = this.next().read_variable();
          return ['set', name, ['bin', '-', name, ['number', 1]]];

        case tokens.T_NEW:
          return this.next().read_new_expr();

        case tokens.T_ISSET:
          this.next().expect('(').next();
          var expr = this.read_variable(true);
          this.expect(')').next();
          return ['sys', 'isset', expr];

        case tokens.T_EMPTY:
          this.next().expect('(').next();
          var expr = this.read_expr();
          this.expect(')').next();
          return ['sys', 'empty', expr];

        case tokens.T_INCLUDE:
          return ['sys', 'include', this.next().read_expr()];

        case tokens.T_INCLUDE_ONCE:
          return ['sys', 'include_once', this.next().read_expr()];

        case tokens.T_REQUIRE:
          return ['sys', 'require', this.next().read_expr()];

        case tokens.T_REQUIRE_ONCE:
          return ['sys', 'require', this.next().read_expr()];

        case tokens.T_EVAL:
          this.next().expect('(').next();
          var expr = this.read_expr();
          this.expect(')').next();
          return ['sys', 'eval', expr];

        case tokens.T_INT_CAST:
          return ['cast', 'int', this.next().read_expr()];

        case tokens.T_DOUBLE_CAST:
          return ['cast', 'double', this.next().read_expr()];

        case tokens.T_STRING_CAST:
          return ['cast', 'string', this.next().read_expr()];

        case tokens.T_ARRAY_CAST:
          return ['cast', 'array', this.next().read_expr()];

        case tokens.T_OBJECT_CAST:
          return ['cast', 'object', this.next().read_expr()];

        case tokens.T_BOOL_CAST:
          return ['cast', 'boolean', this.next().read_expr()];

        case tokens.T_UNSET_CAST:
          return ['sys', 'unset', this.next().read_expr()];

        case tokens.T_EXIT:
          var expr = null;
          if ( this.next().token === '(' ) {
            if (this.next().token !== ')') {
              expr = this.read_expr();
              this.expect(')').next();
            } else {
              this.next();
            }
          }
          return ['sys', 'exit', expr];

        case tokens.T_PRINT:
          return ['sys', 'print', this.next().read_expr()];

        case tokens.T_YIELD:
          var result = ['yield', null, null];
          if (this.next().is('expr')) {
            // reads the yield return value
            result[1] = this.read_expr();
            if (this.token === tokens.T_DOUBLE_ARROW) {
              // reads the yield returned key
              result[2] = this.read_expr();
            }
          }
          return result;

        case tokens.T_FUNCTION:
          // @fixme later - removed static lambda function declarations (colides with static keyword usage)
          return this.read_function(true);

      }

      // SCALAR | VARIABLE
      var expr;
      if (this.is('VARIABLE')) {
        expr = this.read_variable();
        // VARIABLES SPECIFIC OPERATIONS
        switch(this.token) {
          case '=':
            if (this.next().token == '&') {
              if (this.next().token === tokens.T_NEW) {
                return ['link', expr, this.next().read_new_expr()];
              } else {
                return ['link', expr, this.read_variable()];
              }
            } else {
              return [
                'set',
                expr,
                this.token === tokens.T_NEW ?
                  this.next().read_new_expr() : this.read_expr()
              ];
            }
          // operations :
          case tokens.T_PLUS_EQUAL:
            return ['set', expr, ['bin', '+', expr, this.next().read_expr()]];
          case tokens.T_MINUS_EQUAL:
            return ['set', expr, ['bin', '-', expr, this.next().read_expr()]];
          case tokens.T_MUL_EQUAL:
            return ['set', expr, ['bin', '*', expr, this.next().read_expr()]];
          case tokens.T_POW_EQUAL:
            return ['set', expr, ['bin', '**', expr, this.next().read_expr()]];
          case tokens.T_DIV_EQUAL:
            return ['set', expr, ['bin', '/', expr, this.next().read_expr()]];
          case tokens.T_CONCAT_EQUAL:
            // NB : convert as string and add
            return ['set', expr, ['bin', '.', expr, this.next().read_expr()]];
          case tokens.T_MOD_EQUAL:
            return ['set', expr, ['bin', '%', expr, this.next().read_expr()]];
          case tokens.T_AND_EQUAL:
            return ['set', expr, ['bin', '&', expr, this.next().read_expr()]];
          case tokens.T_OR_EQUAL:
            return ['set', expr, ['bin', '|', expr, this.next().read_expr()]];
          case tokens.T_XOR_EQUAL:
            return ['set', expr, ['bin', '^', expr, this.next().read_expr()]];
          case tokens.T_SL_EQUAL:
            return ['set', expr, ['bin', '<<', expr, this.next().read_expr()]];
          case tokens.T_SR_EQUAL:
            return ['set', expr, ['bin', '>>', expr, this.next().read_expr()]];
          case tokens.T_INC:
            this.next();
            return ['post', '+', expr];
          case tokens.T_DEC:
            this.next();
            return ['post', '-', expr];
        }
      } else if (this.is('SCALAR')) {
        expr = this.read_scalar();
      } else {
        this.error('EXPR');
      }

      // returns variable | scalar
      return expr;

    }
    /**
     * <ebnf>
     *    new_expr ::= T_NEW namespace_name function_argument_list
     * </ebnf>
     */
    ,read_new_expr: function() {
      var name = this.read_class_name_reference();
      var args = [];
      if (this.token === '(') {
        args = this.read_function_argument_list();
      }
      return ['new', name, args];
    }
    /**
     * Reads a class name
     * <ebnf>
     * class_name_reference ::= namespace_name | variable
     * </ebnf>
     */
    ,read_class_name_reference: function() {
      if (this.token === '\\' || this.token === tokens.T_STRING) {
        return this.read_namespace_name();
      } else if (this.is('VARIABLE')) {
        return this.read_variable(true);
      } else {
        this.expect([T_STRING, 'VARIABLE']);
      }
    }
    /**
     * <ebnf>
     *   assignment_list ::= T_LIST '(' ((variable? | assignment_list) (',' (variable? | assignment_list))*)? ')'
     * </ebnf>
     */
    ,read_assignment_list: function(innerList) {
      var assignList = [];
      this.expect(tokens.T_LIST).next().expect('(').next();
      while(this.token !== ')' && this.token != EOF) {
        if (this.token === tokens.T_LIST) {
          assignList.push(this.read_assignment_list(true));
        } else {
          if (this.token !== ',') {
            assignList.push(this.read_variable());
          } else {
            assignList.push(null);
          }
        }
        if (this.token !== ',') break;
        this.next();
      }
      this.expect(')').next();
      return ['list', assignList, innerList ? false : this.read_expr()];
    }
  };
};<commit_msg>fix T_LIST assignment expression<commit_after>/**
 * Copyright (C) 2014 Glayzzle (BSD3 License)
 * @authors https://github.com/glayzzle/php-parser/graphs/contributors
 * @url http://glayzzle.com
 */

module.exports = function(api, tokens, EOF) {
  return {

    read_expr: function() {
      var expr = this.read_expr_item();
      switch(this.token) {
        // binary operations
        case '|': return ['bin', '|', expr, this.next().read_expr()];
        case '&': return ['bin', '&', expr, this.next().read_expr()];
        case '^': return ['bin', '^', expr, this.next().read_expr()];
        case '.': return ['bin', '.', expr, this.next().read_expr()];
        case '+': return ['bin', '+', expr, this.next().read_expr()];
        case '-': return ['bin', '-', expr, this.next().read_expr()];
        case '*': return ['bin', '*', expr, this.next().read_expr()];
        case '/': return ['bin', '/', expr, this.next().read_expr()];
        case '%': return ['bin', '%', expr, this.next().read_expr()];
        case tokens.T_POW:  return ['bin', '**', expr, this.next().read_expr()];
        case tokens.T_SL:   return ['bin', '<<', expr, this.next().read_expr()];
        case tokens.T_SR:   return ['bin', '>>', expr, this.next().read_expr()];

        // boolean operations
        case tokens.T_BOOLEAN_OR:
        case tokens.T_LOGICAL_OR:   return ['bool', '|', expr, this.next().read_expr()];

        case tokens.T_BOOLEAN_AND:
        case tokens.T_LOGICAL_AND:  return ['bool', '&', expr, this.next().read_expr()];

        case tokens.T_LOGICAL_XOR:      return ['bool', '^', expr, this.next().read_expr()];
        case tokens.T_IS_IDENTICAL:     return ['bool', '=', expr, this.next().read_expr()];
        case tokens.T_IS_NOT_IDENTICAL: return ['bool', '!=', expr, this.next().read_expr()];
        case tokens.T_IS_EQUAL:         return ['bool', '~', expr, this.next().read_expr()];
        case tokens.T_IS_NOT_EQUAL:     return ['bool', '!~', expr, this.next().read_expr()];
        case '<':                       return ['bool', '<', expr, this.next().read_expr()];
        case '>':                       return ['bool', '>', expr, this.next().read_expr()];

        case tokens.T_IS_SMALLER_OR_EQUAL:  return ['bool', '<=', expr, this.next().read_expr()];
        case tokens.T_IS_GREATER_OR_EQUAL:  return ['bool', '>=', expr, this.next().read_expr()];
        case tokens.T_INSTANCEOF:           return ['bool', '?', expr, this.next().read_expr()];

        // extra operations :
        case tokens.T_COALESCE: // php7 : $username = $_GET['user'] ?? 'nobody';
          return ['retif', ['sys', 'isset', expr], expr, this.next().read_expr()];
        case '?':
          var trueArg = null;
          if (this.next().token !== ':') {
            trueArg = this.read_expr();
          }
          this.expect(':').next();
          return ['retif', expr, trueArg, this.read_expr()];
      }
      return expr;
    }

    /**
     * <ebnf>
     * Reads an expression
     *  expr ::= @todo
     * </ebnf>
     */
    ,read_expr_item: function() {

      switch(this.token) {

        case '@':
          return ['silence', this.next().read_expr()];

        case '-':
        case '+':
        case '!':
        case '~':
          return ['unary', this.token, this.next().read_expr()];

        case '(':
          var expr = this.next().read_expr();
          this.expect(')').next();
          return expr;

        case '`':
          var expr = null;
          if (this.next().token === tokens.T_ENCAPSED_AND_WHITESPACE) {
            expr = this.text();
            this.next().expect('`').next();
          } else if (this.token !== '`' ) {
            expr = this.read_encaps_list();
          }
          return ['sys', 'shell', expr];

        case tokens.T_LIST:
          return this.read_assignment_list();

        case tokens.T_CLONE:
          return ['sys', 'clone', this.next().read_expr()];

        case tokens.T_INC:
          var name = this.next().read_variable();
          return ['set', name, ['bin', '+', name, ['number', 1]]];

        case tokens.T_DEC:
          var name = this.next().read_variable();
          return ['set', name, ['bin', '-', name, ['number', 1]]];

        case tokens.T_NEW:
          return this.next().read_new_expr();

        case tokens.T_ISSET:
          this.next().expect('(').next();
          var expr = this.read_variable(true);
          this.expect(')').next();
          return ['sys', 'isset', expr];

        case tokens.T_EMPTY:
          this.next().expect('(').next();
          var expr = this.read_expr();
          this.expect(')').next();
          return ['sys', 'empty', expr];

        case tokens.T_INCLUDE:
          return ['sys', 'include', this.next().read_expr()];

        case tokens.T_INCLUDE_ONCE:
          return ['sys', 'include_once', this.next().read_expr()];

        case tokens.T_REQUIRE:
          return ['sys', 'require', this.next().read_expr()];

        case tokens.T_REQUIRE_ONCE:
          return ['sys', 'require', this.next().read_expr()];

        case tokens.T_EVAL:
          this.next().expect('(').next();
          var expr = this.read_expr();
          this.expect(')').next();
          return ['sys', 'eval', expr];

        case tokens.T_INT_CAST:
          return ['cast', 'int', this.next().read_expr()];

        case tokens.T_DOUBLE_CAST:
          return ['cast', 'double', this.next().read_expr()];

        case tokens.T_STRING_CAST:
          return ['cast', 'string', this.next().read_expr()];

        case tokens.T_ARRAY_CAST:
          return ['cast', 'array', this.next().read_expr()];

        case tokens.T_OBJECT_CAST:
          return ['cast', 'object', this.next().read_expr()];

        case tokens.T_BOOL_CAST:
          return ['cast', 'boolean', this.next().read_expr()];

        case tokens.T_UNSET_CAST:
          return ['sys', 'unset', this.next().read_expr()];

        case tokens.T_EXIT:
          var expr = null;
          if ( this.next().token === '(' ) {
            if (this.next().token !== ')') {
              expr = this.read_expr();
              this.expect(')').next();
            } else {
              this.next();
            }
          }
          return ['sys', 'exit', expr];

        case tokens.T_PRINT:
          return ['sys', 'print', this.next().read_expr()];

        case tokens.T_YIELD:
          var result = ['yield', null, null];
          if (this.next().is('expr')) {
            // reads the yield return value
            result[1] = this.read_expr();
            if (this.token === tokens.T_DOUBLE_ARROW) {
              // reads the yield returned key
              result[2] = this.read_expr();
            }
          }
          return result;

        case tokens.T_FUNCTION:
          // @fixme later - removed static lambda function declarations (colides with static keyword usage)
          return this.read_function(true);

      }

      // SCALAR | VARIABLE
      var expr;
      if (this.is('VARIABLE')) {
        expr = this.read_variable();
        // VARIABLES SPECIFIC OPERATIONS
        switch(this.token) {
          case '=':
            if (this.next().token == '&') {
              if (this.next().token === tokens.T_NEW) {
                return ['link', expr, this.next().read_new_expr()];
              } else {
                return ['link', expr, this.read_variable()];
              }
            } else {
              return [
                'set',
                expr,
                this.token === tokens.T_NEW ?
                  this.next().read_new_expr() : this.read_expr()
              ];
            }
          // operations :
          case tokens.T_PLUS_EQUAL:
            return ['set', expr, ['bin', '+', expr, this.next().read_expr()]];
          case tokens.T_MINUS_EQUAL:
            return ['set', expr, ['bin', '-', expr, this.next().read_expr()]];
          case tokens.T_MUL_EQUAL:
            return ['set', expr, ['bin', '*', expr, this.next().read_expr()]];
          case tokens.T_POW_EQUAL:
            return ['set', expr, ['bin', '**', expr, this.next().read_expr()]];
          case tokens.T_DIV_EQUAL:
            return ['set', expr, ['bin', '/', expr, this.next().read_expr()]];
          case tokens.T_CONCAT_EQUAL:
            // NB : convert as string and add
            return ['set', expr, ['bin', '.', expr, this.next().read_expr()]];
          case tokens.T_MOD_EQUAL:
            return ['set', expr, ['bin', '%', expr, this.next().read_expr()]];
          case tokens.T_AND_EQUAL:
            return ['set', expr, ['bin', '&', expr, this.next().read_expr()]];
          case tokens.T_OR_EQUAL:
            return ['set', expr, ['bin', '|', expr, this.next().read_expr()]];
          case tokens.T_XOR_EQUAL:
            return ['set', expr, ['bin', '^', expr, this.next().read_expr()]];
          case tokens.T_SL_EQUAL:
            return ['set', expr, ['bin', '<<', expr, this.next().read_expr()]];
          case tokens.T_SR_EQUAL:
            return ['set', expr, ['bin', '>>', expr, this.next().read_expr()]];
          case tokens.T_INC:
            this.next();
            return ['post', '+', expr];
          case tokens.T_DEC:
            this.next();
            return ['post', '-', expr];
        }
      } else if (this.is('SCALAR')) {
        expr = this.read_scalar();
      } else {
        this.error('EXPR');
      }

      // returns variable | scalar
      return expr;

    }
    /**
     * <ebnf>
     *    new_expr ::= T_NEW namespace_name function_argument_list
     * </ebnf>
     */
    ,read_new_expr: function() {
      var name = this.read_class_name_reference();
      var args = [];
      if (this.token === '(') {
        args = this.read_function_argument_list();
      }
      return ['new', name, args];
    }
    /**
     * Reads a class name
     * <ebnf>
     * class_name_reference ::= namespace_name | variable
     * </ebnf>
     */
    ,read_class_name_reference: function() {
      if (this.token === '\\' || this.token === tokens.T_STRING) {
        return this.read_namespace_name();
      } else if (this.is('VARIABLE')) {
        return this.read_variable(true);
      } else {
        this.expect([T_STRING, 'VARIABLE']);
      }
    }
    /**
     * <ebnf>
     *   assignment_list ::= T_LIST '(' ((variable? | assignment_list) (',' (variable? | assignment_list))*)? ')' '=' expr
     * </ebnf>
     */
    ,read_assignment_list: function(innerList) {
      var assignList = [];
      this.expect(tokens.T_LIST).next().expect('(').next();
      while(this.token !== ')' && this.token != EOF) {
        if (this.token === tokens.T_LIST) {
          assignList.push(this.read_assignment_list(true));
        } else {
          if (this.token !== ',') {
            assignList.push(this.read_variable());
          } else {
            assignList.push(null);
          }
        }
        if (this.token !== ',') break;
        this.next();
      }
      this.expect(')').next();
      return [
        'list', assignList,
          innerList ?
            false :
            this.expect('=').next().read_expr()
      ];
    }
  };
};<|endoftext|>


<commit_before>/* @flow */

import { types as tt } from "../tokenizer/types";
import Parser from "./index";
import { lineBreak } from "../util/whitespace";

const pp = Parser.prototype;

// ## Parser utilities

// TODO

pp.addExtra = function (node, key, val) {
  if (!node) return;

  let extra = node.extra = node.extra || {};
  extra[key] = val;
};

// TODO

pp.isRelational = function (op) {
  return this.match(tt.relational) && this.state.value === op;
};

// TODO

pp.expectRelational = function (op) {
  if (this.isRelational(op)) {
    this.next();
  } else {
    this.unexpected();
  }
};

// Tests whether parsed token is a contextual keyword.

pp.isContextual = function (name) {
  return this.match(tt.name) && this.state.value === name;
};

// Consumes contextual keyword if possible.

pp.eatContextual = function (name) {
  return this.state.value === name && this.eat(tt.name);
};

// Asserts that following token is given contextual keyword.

pp.expectContextual = function (name) {
  if (!this.eatContextual(name)) this.unexpected();
};

// Test whether a semicolon can be inserted at the current position.

pp.canInsertSemicolon = function () {
  return this.match(tt.eof) ||
    this.match(tt.braceR) ||
    lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
};

// TODO

pp.isLineTerminator = function () {
  return this.eat(tt.semi) || this.canInsertSemicolon();
};

// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.

pp.semicolon = function () {
  if (!this.eat(tt.semi) && !this.canInsertSemicolon()) this.unexpected();
};

// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.

pp.expect = function (type) {
  return this.eat(type) || this.unexpected();
};

// Raise an unexpected token error.

pp.unexpected = function (pos) {
  this.raise(pos != null ? pos : this.state.start, "Unexpected token");
};
<commit_msg>simplify Parser::semicolon method<commit_after>/* @flow */

import { types as tt } from "../tokenizer/types";
import Parser from "./index";
import { lineBreak } from "../util/whitespace";

const pp = Parser.prototype;

// ## Parser utilities

// TODO

pp.addExtra = function (node, key, val) {
  if (!node) return;

  let extra = node.extra = node.extra || {};
  extra[key] = val;
};

// TODO

pp.isRelational = function (op) {
  return this.match(tt.relational) && this.state.value === op;
};

// TODO

pp.expectRelational = function (op) {
  if (this.isRelational(op)) {
    this.next();
  } else {
    this.unexpected();
  }
};

// Tests whether parsed token is a contextual keyword.

pp.isContextual = function (name) {
  return this.match(tt.name) && this.state.value === name;
};

// Consumes contextual keyword if possible.

pp.eatContextual = function (name) {
  return this.state.value === name && this.eat(tt.name);
};

// Asserts that following token is given contextual keyword.

pp.expectContextual = function (name) {
  if (!this.eatContextual(name)) this.unexpected();
};

// Test whether a semicolon can be inserted at the current position.

pp.canInsertSemicolon = function () {
  return this.match(tt.eof) ||
    this.match(tt.braceR) ||
    lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
};

// TODO

pp.isLineTerminator = function () {
  return this.eat(tt.semi) || this.canInsertSemicolon();
};

// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.

pp.semicolon = function () {
  if (!this.isLineTerminator()) this.unexpected();
};

// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.

pp.expect = function (type) {
  return this.eat(type) || this.unexpected();
};

// Raise an unexpected token error.

pp.unexpected = function (pos) {
  this.raise(pos != null ? pos : this.state.start, "Unexpected token");
};
<|endoftext|>


<commit_before>
/**
 * Batch test BigEval over randomly generated expressions
 * Compared with eval()'s output
 * @param test
 * @param b - The BigEval object
 */
function autoTest(test, b){
	//var b = new obj();
	var l = 5000; // no of tests
	var m = 15; // max size of expression

	var sz, j, exp, r1, r2;
	var ops = "+-/*&^|%"; // 7 (mod can be problem, - divide)

	for (var i = 0; i<l; i++){
		sz = Math.floor((Math.random() * m + 3));
		if (sz % 2 === 0) {
			sz++;
		}
		exp = "";
		for (j = 0; j < sz; j++){ // build exp
			if (j%2 === 0) {
				exp += Math.floor(Math.random() * 20 - 9); // -9
			} else {
				exp += ops[Math.floor(Math.random() * 8)];
			}
		}
		exp = b.plusMinus(exp);

		r1 = b.exec(exp);
		r2 = eval(exp);

        if (r1 !== r2 && (!isNaN(r1) || !isNaN(r2))) { // precision
            console.log(i + " exp=  " + exp + " bigeval= " + r1 + " real= " + r2);
            test.equals(r1, r2);
            test.done();
            break;
        }
	}
	test.equals(1,1);
	test.done();
}

/**
 * Export
 */
exports.autoTest = autoTest;<commit_msg>Added tests for all operators<commit_after>
/**
 * Batch test BigEval over randomly generated expressions
 * Compared with eval()'s output
 * @param test
 * @param b - The BigEval object
 */
function autoTest(test, b){
	//var b = new obj();
	var l = 5000; // no of tests
	var m = 15; // max size of expression

	var sz, j, exp, r1, r2;
	var ops = [
		'/', '*', '%',
		'+', '-',
		'<<', '>>',
		'<', '<=', '>', '>=',
		'==', '!=',
		'&', '^', '|',
		'&&', '||'];

	try {
		eval('1**2'); // Check if current runtime support ** operator
		ops.push('**');
	} catch (e) {}

	for (var i = 0; i<l; i++){
		sz = Math.floor((Math.random() * m + 3));
		if (sz % 2 === 0) {
			sz++;
		}

		exp = "";
		for (j = 0; j < sz; j++){ // build exp
			if (j%2 === 0) {
				exp += Math.floor(Math.random() * 20 - 9); // -9
			} else {
				exp += ops[Math.floor(Math.random() * ops.length)];
			}
		}
		exp = b.plusMinus(exp); // Normalize doubles (--, ++) as eval will consider as postfix/prefix operations

		r1 = b.exec(exp);
		r2 = eval(exp);

		if (r1 !== r2 && (!isNaN(r1) || !isNaN(r2))) { // precision
			console.log(i + " exp=  " + exp + " bigeval= " + r1 + " real= " + r2);
			test.equals(r1, r2);
			test.done();
			break;
		}
	}
	test.equals(1,1);
	test.done();
}

/**
 * Export
 */
exports.autoTest = autoTest;<|endoftext|>


<commit_before>define({
	proxyPort: 9000,
	proxyUrl: 'http://localhost:9000/',

	capabilities: {
		'selenium-version': '2.41.0'
	},

	environments: [
		{ browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' },
		{ browserName: 'internet explorer', version: '10', platform: 'Windows 8' },
		{ browserName: 'internet explorer', version: '9', platform: 'Windows 7' },
		{ browserName: 'firefox', version: '29.0', platform: [ 'Windows 7', 'Windows XP', 'Linux', 'OS X 10.9' ] },
		{ browserName: 'chrome', version: '35.0', platform: [ 'Windows 7', 'Windows XP', 'Linux', 'OS X 10.9' ] },
		{ browserName: 'safari', version: '6', platform: 'OS X 10.8' },
		{ browserName: 'safari', version: '7', platform: 'OS X 10.9' }
	],

	maxConcurrency: 3,

	tunnel: 'SauceLabsTunnel',

	useLoader: {
		'host-node': 'dojo/dojo',
		'host-browser': 'node_modules/dojo/dojo.js'
	},

	loader: {
		packages: [
			{ name: 'core', location: '.'}
		]
	},

	suites: [ 'core/tests/unit' ],

	functionalSuites: [],

	excludeInstrumentation: /^tests\/|^node_modules\//

});<commit_msg>Upgrade browser versions for testing.<commit_after>define({
	proxyPort: 9000,
	proxyUrl: 'http://localhost:9000/',

	capabilities: {
		'selenium-version': '2.41.0'
	},

	environments: [
		{ browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' },
		{ browserName: 'internet explorer', version: '10', platform: 'Windows 8' },
		{ browserName: 'internet explorer', version: '9', platform: 'Windows 7' },
		{ browserName: 'firefox', version: '30.0', platform: [ 'Windows 7', 'Windows XP', 'Linux', 'OS X 10.9' ] },
		{ browserName: 'chrome', version: '35.0', platform: [ 'Windows 7', 'Windows XP', 'Linux', 'OS X 10.9' ] },
		{ browserName: 'safari', version: '6', platform: 'OS X 10.8' },
		{ browserName: 'safari', version: '7', platform: 'OS X 10.9' }
	],

	maxConcurrency: 3,

	tunnel: 'SauceLabsTunnel',

	useLoader: {
		'host-node': 'dojo/dojo',
		'host-browser': 'node_modules/dojo/dojo.js'
	},

	loader: {
		packages: [
			{ name: 'core', location: '.'}
		]
	},

	suites: [ 'core/tests/unit' ],

	functionalSuites: [],

	excludeInstrumentation: /^tests\/|^node_modules\//

});<|endoftext|>


<commit_before>buster.testCase("Backbone.Validation events", {
    setUp: function() {
        var Model = Backbone.Model.extend({
            validation: {
                age: function(val){
                    if(!val) return 'age';
                },
                name: function(val){
                    if(!val) return 'name';
                }
            }
        });

        this.model = new Model();
        this.view = new Backbone.View({
            model: this.model
        });

        Backbone.Validation.bind(this.view);
    },

    "model is updated before the events are raised": function() {
        this.model.bind('change', function(){
            assert.equals(1, this.model.get('age'));
        }, this);

        this.model.bind('validated', function(){
            assert.equals(1, this.model.get('age'));
        }, this);

        this.model.bind('validated:valid', function(){
            assert.equals(1, this.model.get('age'));
        }, this);

        this.model.set({
            age: 1,
            name: 'name'
        });
    },

    "when model is valid": {
        "validated event is triggered with true and model": function(done) {
            this.model.bind('validated', function(valid, model){
                assert(valid);
                assert.same(this.model, model);
                done();
            }, this);

            this.model.set({
                age: 1,
                name: 'name'
            });
        },

        "validated:valid event is triggered with model": function(done) {
            this.model.bind('validated:valid', function(model){
                assert.same(this.model, model);
                done();
            }, this);

            this.model.set({
                age: 1,
                name: 'name'
            });
        }
    },

    "when one invalid value is set": {
        "validated event is triggered with false, model, and name of attributes with error": function(done) {
            this.model.bind('validated', function(valid, model, attr){
                refute(valid);
                assert.same(this.model, model);
                assert.equals(['age', 'name'], attr);
                done();
            }, this);

            this.model.set({age:0});
        },

        "validated:invalid event is triggered with model and name of attributes with error": function(done) {
            this.model.bind('validated:invalid', function(model, attr){
                assert.same(this.model, model);
                assert.equals(['age', 'name'], attr);
                done();
            }, this);

            this.model.set({age:0});
        },

        "error event is triggered with model and error as an array of attribute names with error": function(done) {
            this.model.bind('error', function(model, error) {
                assert.same(this.model, model);
                assert.equals(['age', 'name'], error);
                done();
            }, this);

            this.model.set({age:0});
        }
    },

    "when one valid value is set": {
        "validated event is triggered with false, model, and an array with the names of the attributes with error": function(done) {
            this.model.bind('validated', function(valid, model, attrs){
                refute(valid);
                assert.same(this.model, model);
                assert.equals(['name'], attrs);
                done();
            }, this);

            this.model.set({
                age: 1
            });
        },

        "validated:invalid event is triggered with model and an array with the names of the attributes with error": function(done) {
            this.model.bind('validated:invalid', function(model, attrs){
                assert.same(this.model, model);
                assert.equals(['name'], attrs);
                done();
            }, this);

            this.model.set({
                age: 1
            }, this);
        },

        "error event is triggered with model and error as an array": function(done) {
            this.model.bind('error', function(model, error) {
                assert.equals(['name'], error);
                done();
            }, this);

            this.model.set({
                age: 1
            });
        }
    }
});<commit_msg>Removed incorrect test<commit_after>buster.testCase("Backbone.Validation events", {
    setUp: function() {
        var Model = Backbone.Model.extend({
            validation: {
                age: function(val){
                    if(!val) return 'age';
                },
                name: function(val){
                    if(!val) return 'name';
                }
            }
        });

        this.model = new Model();
        this.view = new Backbone.View({
            model: this.model
        });

        Backbone.Validation.bind(this.view);
    },

    "model is updated before the events are raised": function() {
        this.model.bind('change', function(){
            assert.equals(1, this.model.get('age'));
        }, this);

        this.model.bind('validated', function(){
            assert.equals(1, this.model.get('age'));
        }, this);

        this.model.bind('validated:valid', function(){
            assert.equals(1, this.model.get('age'));
        }, this);

        this.model.set({
            age: 1,
            name: 'name'
        });
    },

    "when model is valid": {
        "validated event is triggered with true and model": function(done) {
            this.model.bind('validated', function(valid, model){
                assert(valid);
                assert.same(this.model, model);
                done();
            }, this);

            this.model.set({
                age: 1,
                name: 'name'
            });
        },

        "validated:valid event is triggered with model": function(done) {
            this.model.bind('validated:valid', function(model){
                assert.same(this.model, model);
                done();
            }, this);

            this.model.set({
                age: 1,
                name: 'name'
            });
        }
    },

    "when one invalid value is set": {
        "validated event is triggered with false, model, and name of attributes with error": function(done) {
            this.model.bind('validated', function(valid, model, attr){
                refute(valid);
                assert.same(this.model, model);
                assert.equals(['age', 'name'], attr);
                done();
            }, this);

            this.model.set({age:0});
        },

        "validated:invalid event is triggered with model and name of attributes with error": function(done) {
            this.model.bind('validated:invalid', function(model, attr){
                assert.same(this.model, model);
                assert.equals(['age', 'name'], attr);
                done();
            }, this);

            this.model.set({age:0});
        },

        "error event is triggered with model and error as an array of attribute names with error": function(done) {
            this.model.bind('error', function(model, error) {
                assert.same(this.model, model);
                assert.equals(['age', 'name'], error);
                done();
            }, this);

            this.model.set({age:0});
        }
    },

    "when one valid value is set": {
        "validated event is triggered with false, model, and an array with the names of the attributes with error": function(done) {
            this.model.bind('validated', function(valid, model, attrs){
                refute(valid);
                assert.same(this.model, model);
                assert.equals(['name'], attrs);
                done();
            }, this);

            this.model.set({
                age: 1
            });
        },

        "validated:invalid event is triggered with model and an array with the names of the attributes with error": function(done) {
            this.model.bind('validated:invalid', function(model, attrs){
                assert.same(this.model, model);
                assert.equals(['name'], attrs);
                done();
            }, this);

            this.model.set({
                age: 1
            }, this);
        }
    }
});<|endoftext|>