Skip to content

Instantly share code, notes, and snippets.

View mtheoryx's full-sized avatar
🐳
Making happy little clouds

David Poindexter mtheoryx

🐳
Making happy little clouds
View GitHub Profile
@mtheoryx
mtheoryx / index.js
Created June 30, 2017 16:21
Create React App with HMR (Hot Module Replacement)
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
// Enable HMR
@mtheoryx
mtheoryx / packages.txt
Created June 2, 2017 12:25
It's dependency managers all the way down.
How can I get jQuery?
Install it with Bower (a package manager)
How can I get Bower?
Install it with yarn (a package manager)
How can I get yarn?
Install it with npm (a package manager)
How can I get npm?
Install it with nvm (node version manager)
How can I get nvm?
Install it with Homebrew (a mac package manager)
@mtheoryx
mtheoryx / new_gist_file_0
Created April 13, 2017 21:05
gitignore template for node projects
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
@mtheoryx
mtheoryx / 0_reuse_code.js
Created February 10, 2017 22:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mtheoryx
mtheoryx / eg-perf.md
Created January 20, 2017 15:29
Summary of performance optimizations found

#Summary of optimizations in Ember-Graph

This combines 3 branches worth of optimization work into one PR

TL;DR version by branch:

First branch: feature/addingHash

  • Adds a hash to store/relationship.js to allow quickly locating a relationship based on the id values of the endpoints
import React from 'react';
import { shallow } from 'enzyme';
// Subject Under Test
import App from './App';
const app = shallow(<App />);
test('Renders nested components', () => {
expect(app.find('Header').length).toEqual(1);
@mtheoryx
mtheoryx / App.js
Created January 14, 2017 18:38
Needs tests!
import React, { Component } from 'react';
import './App.css';
import sampleData from '../../data/demo.js';
import Header from '../Header/Header';
import Intro from '../Intro/Intro';
import Students from '../Students/Students';
import Summary from '../Summary/Summary';
class App extends Component {
shareToFacebookPress() {
const timeNow = Date.now();
const facebookToken = this.props.facebook_token;
console.log(facebookToken);
const facebookExpiry = this.props.facebook_token_expiry * 1000;
console.log(facebookExpiry);
@mtheoryx
mtheoryx / DeleteButton.test.js
Created January 2, 2017 20:51
DeleteButton.test.js
//noinspection JSUnresolvedVariable
import React from 'react';
//noinspection JSUnresolvedVariable
import ReactDOM from 'react-dom';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import DeleteButton from './DeleteButton';
describe('DeleteButton component', () => {
@mtheoryx
mtheoryx / DeleteButton.js
Created January 2, 2017 20:35
DeleteButton.js
import React from 'react';
import './DeleteButton.css';
const DeleteButton = ({ onDelete, itemId }) => (
<button
className="DeleteButton"
onClick={ () => onDelete(itemId) }>
&nbsp;
</button>
);