Skip to content

Instantly share code, notes, and snippets.

View 15Dkatz's full-sized avatar
👨‍🍳
Cooking up a course

David Katz 15Dkatz

👨‍🍳
Cooking up a course
View GitHub Profile
@15Dkatz
15Dkatz / installing_postgresql.md
Last active December 25, 2023 06:29
PostgreSQL installation tutorial

Let's install PostgreSQL onto your operating system.

As an open source object-relational database management system, PostgreSQL available for MacOS, Linux, and Windows.

Goal for each Operating System

The goal will be to run the following command successfully from the command line (regardless of the OS):

psql -U postgres

This should open the psql interactive shell and print a prompt that looks like:

const express = require('express');
const request = require('request');
const app = express();
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
next();
});
@15Dkatz
15Dkatz / index.html
Last active October 2, 2019 14:44
Parcel-react-jest - index.html
<!doctype html>
<html>
<body>
<div id="root"></div>
<script src="index.js"></script>
</body>
</html>
@15Dkatz
15Dkatz / cloneDeep.js
Created May 1, 2019 18:04
An approach to deep cloning objects in JavaScript
const cloneDeep = source => {
const result = {};
Object.entries(source).forEach(entry => {
const [key, value] = entry;
if (typeof value === 'object') {
result[key] = cloneDeep(value);
} else {
result[key] = value;
@15Dkatz
15Dkatz / CourseDiscounts.md
Last active April 20, 2019 06:42
List of discounts for courses taught by David Katz
@15Dkatz
15Dkatz / selections.txt
Last active March 30, 2019 16:48 — forked from craiglittle/selections.txt
Prior selections by the Zendesk Film Salon
Weiner (2016) - Josh Lam [March 17, 2017]
Rumble in the Bronx (1995) - Josh Lam [March 24, 2017]
Grey Gardens (1975) - Kristina Garfinkel [March 31, 2017]
Real Genius (1985) - Alex Stone [April 7, 2017]
Trainspotting (1996) - Kristen Mirenda [April 14, 2017]
Mulholland Drive (2001) - Craig Little [April 21, 2017]
Blue Velvet (1986) - Kristen Mirenda [April 28, 2017]
Dear Zachary: A Letter to a Son About His Father (2008) - Josh Lam [May 5, 2017]
One Flew Over the Cuckoo's Nest (1975) - Kristina Garfinkel [May 12, 2017]
The Man from Earth (2007) - Sujay Sudheendra [May 26, 2017]
const INITIAL_GAME_STATE = { victory: false, startTime: null, endTime: null };
const [snippet, setSnippet] = useState('');
const [userText, setUserText] = useState('');
const [gameState, setGameState] = useState(INITIAL_GAME_STATE);
{snippet}
<h4>{gameState.victory ? `Done! 🎉 Time: ${gameState.endTime}ms` : null}</h4>
<input value={userText} onChange={updateUserText} />
class App extends React.Component {
state = { userText: '' };
updateUserText = event => {
this.setState({ userText: event.target.value });
console.log('current userText', this.state.userText);
}
render() {
return (
import React from 'react';
import { shallow } from 'enzyme';
import App from './App';
describe('App', () => {
const app = shallow(<App />);
it('renders the title', () => {
expect(app.find('h1').exists()).toBe(true);
});