Skip to content

Instantly share code, notes, and snippets.

@julesbou
julesbou / install.sh
Last active September 9, 2019 09:26
Debian 6.0 (Squeeze) 64 bits - (NodeJS/Nginx/Mongodb) - Suited for Frontend/Backend
###
### Debian configuration
###
# --- Bashrc ---
echo "
@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':
@julesbou
julesbou / benchmark.php
Created September 12, 2011 22:31
[benchmark] text file VS mysql VS apc
<?php
// Usage:
//
// $ php benchmar.php
// or
// $ php benchmark.php 1000 // to execute 1000 times
$pdo = new \PDO('sqlite://:memory:');
$pdo->exec("CREATE TABLE IF NOT EXISTS `Users` (
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() {
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', ...)
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
}
}
}
});