Skip to content

Instantly share code, notes, and snippets.

View hrkd's full-sized avatar
🎯
Focusing

hrkd

🎯
Focusing
View GitHub Profile
@hrkd
hrkd / Gruntfile.js
Last active December 16, 2015 18:49 — forked from anonymous/Gruntfile.js
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
@hrkd
hrkd / the-bind-problem.jsx
Created September 25, 2017 11:36 — forked from Restuta/the-bind-problem.jsx
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));