Skip to content

Instantly share code, notes, and snippets.

View conorhastings's full-sized avatar
🏄‍♂️
9-5, just to make a living

Conor Hastings conorhastings

🏄‍♂️
9-5, just to make a living
View GitHub Profile
@conorhastings
conorhastings / test.js
Created November 9, 2015 05:35
Bad JSX highlighting
import React, { Component } from 'react';
class Test extends Component {
render() {
return (
<div>
Wowowow ' this is fun
</div>
);
}
@conorhastings
conorhastings / another-test.js
Created November 9, 2015 05:44
another jsx test
var Component = React.createClass({
render: function() {
return(
<div>
Conor's my name
</div>
);
}
});
class Whatever extends Component {
render() {
return (
<div>Wow's this is cool</div>
);
}
}
@conorhastings
conorhastings / simple-redux.js
Last active June 11, 2021 01:36
A very (read: don't do this) simple implementation of redux
/*
* The reason for this is just a thought exercise
* often people(myself super included) are so confused
* when trying something new, but breaking it down
* to it's simplest existence can be the best way to understand
*/
function createStore(reducer, initState) {
let state = initState;
let subscribers = [];
@conorhastings
conorhastings / doesnotwork.js
Last active March 23, 2016 02:30
Node allows use of const (but not let) outside of strict mode but does not seem to respect block scoping
/*
* In this version without use strict declaration 'SyntaxError: Identifier 'text' has already been declared' is given
*/
const http = require('http');
const hostname = 'localhost';
const port = 2001;
http.createServer((req, res) => {
if (req.url === '/favicon.ico') {
import React from 'react';
import { render } from 'react-dom';
import SyntaxHighlighter from 'react-syntax-highlighter';
import { docco } from 'react-syntax-highlighter/dist/styles'
import markdown from 'markdown';
class X extends React.Component {
render() {
return (
<SyntaxHighlighter language='javascript' style={docco}>
@conorhastings
conorhastings / esnextbin.md
Created July 21, 2016 13:53
esnextbin sketch
@conorhastings
conorhastings / esnextbin.md
Created August 10, 2016 12:52
esnextbin sketch
@conorhastings
conorhastings / esnextbin.md
Created October 10, 2016 19:14
esnextbin sketch
@conorhastings
conorhastings / react-refs.js
Created January 20, 2017 03:28
react refs
/* node will be null */
function Input() {
return <input />;
}
function InputContainer() {
return <div><Input ref={node => console.log(node)} /></div>;
}
/* node will be vnode instance */