Skip to content

Instantly share code, notes, and snippets.

@julesbou
julesbou / App.js
Last active January 23, 2017 15:49
import React, { Component } from 'react'
import { connect } from 'react-redux'
import WorldPop from './components/WorldPop/WorldPop'
class App extends Component {
render() {
let $chart
switch (this.props.chart) {
case 'WorldPop':
Node.prototype.on = HTMLElement.prototype.addEventListener
NodeList.prototype.on = function(event, cb) {
Array.prototype.forEach.call(this, el => el.addEventListener(event, cb))
}
// usage: $('.element').on('click', ...)
// usage: $('.list-of-elements').on('click', ...)
HTMLElement.prototype.show = function() {
this.style.display = ''
}
HTMLElement.prototype.hide = function() {
this.style.display = 'none'
}
HTMLElement.prototype.toggle = function(bool) {
this.style.display = bool ? '' : 'none'
}
HTMLElement.prototype.visible = function() {
NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]
// usage: $$('.list-of-elements').forEach(...)
// usage: $$('.list-of-elements').map(...)
window.$ = document.querySelector.bind(document)
window.$$ = document.querySelectorAll.bind(document)
HTMLElement.prototype.$ = HTMLElement.prototype.querySelector
HTMLElement.prototype.$$ = HTMLElement.prototype.querySelectorAll
// usage: $('.select-on-element')
// usage: $$('.select-a-list-of-element')
SERVER_URL?='http://website.dev'
echo_server:
echo $(SERVER_URL)
livereload:
livereload --exts "less js html"
grunt.initConfig({
watch: {
all: {
files: ['*.less', '*.js', '*.html'],
options: {
livereload: true
}
}
}
});
watch:
watchy -w css/**/*.less -- make css
grunt.initConfig({
watch: {
less: {
files: ['css/**/*.less'],
tasks: ['css']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');