Skip to content

Instantly share code, notes, and snippets.

View hpjaj's full-sized avatar

Harry Levine hpjaj

View GitHub Profile
{
"data": {
"type": "will_paginate_collections",
"attributes": {
"items": [
{
"item": {
"id": 156,
"type": "Accomplishment",
"description": "Flexitarian hoodie tousled skateboard umami. Chicharrones single-origin coffee swag wayfarers semiotics kickstarter. Quinoa before they sold out godard jean shorts.",
Email First Name Last Name Birthday Work Anniversary Team
john@company.com John Smith 04/29/1995 02/26/2015 Sales
frank@company.com Frank Thompson 11/12/1977 Operations
susan@company.com Susan Sanchez 12/15/2018
dennis@gmail.com Dennis Meeker 01/05/1970 09/28/1992 Operations
admin@example.com Admin Sanchez 11/12/1977 12/15/2018
admin@example.com Admin Sanchez 11/12/1977 12/15/2018
harry@example.com Harry Levine 11/12/1977 12/15/2018
malte@example.com Malte Muenke 11/12/1977 12/15/2018
nate@example.com Nate Vogels 11/12/1977 12/15/2018
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "vets.gov API",
"description": "The API for managing vets.gov",
"termsOfService": "",
"contact": {
"name": "vets.gov team"
},
// app/javascript/components/NewPost.js
...
import { passCsrfToken } from '../util/helpers'
class NewPost extends React.Component {
state = {
title: '',
body: ''
}
// app/javascript/util/helpers.js
function csrfToken(document) {
return document.querySelector('[name="csrf-token"]').content;
}
export function passCsrfToken(document, axios) {
axios.defaults.headers.common['X-CSRF-TOKEN'] = csrfToken(document);
}
// app/javascript/components/NewPost.js
handleSubmit = event => {
event.preventDefault();
const post = {
title: this.state.title,
body: this.state.body
}
// app/javascript/components/NewPost.js
...
handleSubmit = event => {
event.preventDefault();
}
render() {
return (
<div>
// app/javascript/components/NewPost.js
import axios from 'axios'
...
// app/javascript/components/NewPost.js
import React from 'react'
class NewPost extends React.Component {
state = {
title: '',
body: ''
}