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 / 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 / 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 express = require('express');
const request = require('request');
const app = express();
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
next();
});
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 (
@15Dkatz
15Dkatz / CourseDiscounts.md
Last active April 20, 2019 06:42
List of discounts for courses taught by David Katz
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);
});
@15Dkatz
15Dkatz / setupTests.js
Created January 21, 2018 21:43
Parcel-react-jest - setupTests.js
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
@15Dkatz
15Dkatz / .babelrc
Created January 21, 2018 21:35
Parcel-react-jest - .babelrc
{
"presets": ["env", "react"]
}