Skip to content

Instantly share code, notes, and snippets.

View heaversm's full-sized avatar

Mike Heavers heaversm

View GitHub Profile
@heaversm
heaversm / react_to_google_sheets_form.js
Created July 2, 2019 11:05
Storing form data from a website in Google Spreadsheets using javascript
import { Form, Text } from 'informed'; //https://joepuzzo.github.io/informed/
import React from 'react';
const SPREADSHEET_ID = 'nhlD3E6xsi2lbDQ71HTJ3oQ1Ql5dIkuiK4IoZYjHD'; //from the URL of your blank Google Sheet
const CLIENT_ID = '2d280542491u-3aofp4eFeftog7q0u5a73ro566h8vi.apps.googleusercontent.com'; //from https://console.developers.google.com/apis/credentials
const API_KEY = 'AIzaSyCz5fYFuCORKGXSGu4IwKq4U_HfcdDtB'; //https://console.developers.google.com/apis/credentials
const SCOPE = 'https://www.googleapis.com/auth/spreadsheets';
export default class ContactForm extends React.Component {
@heaversm
heaversm / ideo_design_thinking_process.md
Last active July 7, 2019 21:21
Ideo Design Thinking Process

DESIGN THINKING

PHASES:

Inspiration

Frame the design challenge.

@heaversm
heaversm / react_patterns.js
Last active August 14, 2020 18:37
React stuff I use all the time but forget how to do
//Set state in react to the previous state plus an updated value:
const initState = {
thing1: 0,
thing2: null,
thing3: false,
};
const [state, setState] = useState(initState);
@heaversm
heaversm / contentful-query-examples.js
Created July 25, 2019 18:54
Examples of different ways to query contentful
let contentfulClient = contentful.createClient({
space: '[space_id]',
accessToken: '[access_token]'
});
//GET ALL ENTRIES
contentfulClient.getEntries().then(entries => {
console.log(entries); //gets everything
entries.items.forEach(entry => {
@heaversm
heaversm / regex.js
Created August 5, 2019 15:54
useful regexes
//find all instances of [thing1] NOT followed by [thing2]:
^(?!.*thing2).*thing1
@heaversm
heaversm / mac-management.js
Created August 5, 2019 16:10
Mac Management
//DELETE SAVED UNDO HISTORY FOR PROGRAMS
/.DocumentRevisions-V100/
@heaversm
heaversm / index.html
Last active March 5, 2023 20:54
Create animated transitions between StyleGAN images with P5.js and Runway ML
<html>
<head>
<script src="js/lib/p5.js"></script>
<script src="js/lib/p5.dom.js"></script>
<script src="js/lib/toxiclibs.js"></script>
<script src="data/landscape.js"></script>
<script src="js/stylegan-transition.js"></script>
</head>
<body>
</body>
@heaversm
heaversm / runway-model-info.js
Created August 14, 2019 19:48
Get Runway Model Info as JSON
let modelOutput;
fetch('http://localhost:8000/info')
.then(response => response.json())
.then(output => {
modelOutput = output;
// use the output in your project
console.log(output);
//to copy it from the console, right click the object in chrome and choose 'save as global variable'
//then type copy(temp1) and paste the clipboard contents into a .json file
@heaversm
heaversm / server-commands.sh
Last active August 8, 2020 04:39
Server Commands
php -S localhost:8080
#boots a local php server
python -m SimpleHTTPServer
#boots a local http server on python 2
python -m http.server
#boots a local http server on python 3
sass --watch main.scss main.css
@heaversm
heaversm / common-python-commands.sh
Last active February 26, 2020 18:56
Frequently used python commands
#pyenv
#have pyenv manage versions:
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
#activate changes:
source ~/.bash_profile
#install particular versions
pyenv install X.X.X