Skip to content

Instantly share code, notes, and snippets.

@jakedohm
jakedohm / LoginForm.vue
Last active March 22, 2019 22:57
A Vue component to handle submitting login details with Axios, instead of with a standard HTML form
<template>
<form method="post" accept-charset="UTF-8">
<label for="loginName">Username or email</label>
<input v-model="loginName" id="loginName" type="text" name="loginName" />
<label for="password">Password</label>
<input v-model="password" id="password" type="password" name="password" />
<label>
<input v-model="rememberMe" type="checkbox" name="rememberMe" />
const { setContext } = require('apollo-link-context');
const { HttpLink } = require('apollo-link-http');
const { introspectSchema, makeRemoteExecutableSchema } = require('graphql-tools');
const fetch = require('node-fetch');
module.exports = function(api) {
api.createSchema(async function(graphql) {
const http = new HttpLink({
uri: 'http://example.com/api',
fetch
@jakedohm
jakedohm / getState.twig
Created July 17, 2017 13:22
A twig (Craft CMS templating language) macro to get the full state name from the abbreviated version
{# Macro #}
{% macro getState(abbr) %}
{% set states = {
'AL' : 'Alabama',
'AK' : 'Alaska',
'AZ' : 'Arizona',
'AR' : 'Arkansas',
'CA' : 'California',
'CO' : 'Colorado',
'CT' : 'Connecticut',