Skip to content

Instantly share code, notes, and snippets.

View DavidMellul's full-sized avatar

David Mellul DavidMellul

View GitHub Profile
const sidebar = document.getElementById('sidebar');
const button = document.getElementById('toggle');
button.addEventListener('click', _ => {
sidebar.classList.toggle('collapsed');
});
<body>
<div id="sidebar"></div>
<div id="content">
<button id="toggle">Hide / Show sidebar</button>
</div>
</body>
html, body {
width: 100%;
height: 100%;
margin: 0;
}
#sidebar, #content {
height: 100%;
overflow:auto;
float:left;
const gulp = require('gulp');
const less = require('gulp-less');
// Where your Less files are located
const srcDir = './src/assets/style/less';
// Where your CSS files will be generated
const dstDir = './src/assets/style/css';
gulp.task('less', function() {
gulp
ga('send', 'event', 'Category', 'Action'); // Minimal
ga('send', 'event', 'Category', 'Action', 'Label', 'Value'); // Full
function print() {
const filename = 'ThisIsYourPDFFilename.pdf';
html2canvas(document.querySelector('#nodeToRenderAsPDF')).then(canvas => {
let pdf = new jsPDF('p', 'mm', 'a4');
pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0, 211, 298);
pdf.save(filename);
});
}
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(author|tag|category)\/.+$ / [L,R=301]
</IfModule>
class Pizza {
protected Pizza base;
Pizza() {}
Pizza(Pizza base) {
this.base = base;
}
public int cost() {
import java.util.Observer;
import java.util.Observable;
class Margherita extends Observable {
private boolean isOutOfDate;
Margherita() {
this.isOutOfDate = false;
}
<div className="content">
{
tabs.map(
(tab, index) => <div key={index} className={index === active ? 'shown':'hidden'}>
{tab.component}
</div>
);
}
</div>