Skip to content

Instantly share code, notes, and snippets.

Avatar

Harry Levine hpjaj

View GitHub Profile
View api-v2-activity-feed-index-response.json
{
"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.",
View master-list.csv
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
View Vets-API Open API spec.json
{
"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"
},
View rails-with-react-new-post-7.jsx
// app/javascript/components/NewPost.js
...
import { passCsrfToken } from '../util/helpers'
class NewPost extends React.Component {
state = {
title: '',
body: ''
}
View rails-with-react-helpers.js
// 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);
}
View rails-with-react-new-post-6.jsx
// app/javascript/components/NewPost.js
handleSubmit = event => {
event.preventDefault();
const post = {
title: this.state.title,
body: this.state.body
}
View rails-with-react-new-post-5.jsx
// app/javascript/components/NewPost.js
...
handleSubmit = event => {
event.preventDefault();
}
render() {
return (
<div>
View rails-with-react-new-post-4.jsx
// app/javascript/components/NewPost.js
import axios from 'axios'
...
View rails-with-react-new-post-3.jsx
// app/javascript/components/NewPost.js
import React from 'react'
class NewPost extends React.Component {
state = {
title: '',
body: ''
}