$ rails g model User
belongs_to
has_one
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
First you will need to get an OAuth Token from GitHub using your own username and "note"
require('isomorphic-fetch'); | |
fetch('https://1jzxrj179.lp.gql.zone/graphql', { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ query: '{ posts { title } }' }), | |
}) | |
.then(res => res.json()) | |
.then(res => console.log(res.data)); |
#!/usr/bin/env node | |
'use strict'; | |
var fs = require('fs'); | |
var path = require('path'); | |
fs.ensureDirSync = function (dir) { | |
if (!fs.existsSync(dir)) { | |
dir.split(path.sep).reduce(function (currentPath, folder) { | |
currentPath += folder + path.sep; |