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
[email protected] John Smith 04/29/1995 02/26/2015 Sales
[email protected] Frank Thompson 11/12/1977 Operations
[email protected] Susan Sanchez 12/15/2018
[email protected] Dennis Meeker 01/05/1970 09/28/1992 Operations
[email protected] Admin Sanchez 11/12/1977 12/15/2018
[email protected] Admin Sanchez 11/12/1977 12/15/2018
[email protected] Harry Levine 11/12/1977 12/15/2018
[email protected] Malte Muenke 11/12/1977 12/15/2018
[email protected] 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: ''
}