Skip to content

Instantly share code, notes, and snippets.

View klugjo's full-sized avatar
🧙
Disbelief in magic can force a poor soul into believing in govt and business

Klughertz Jonathan klugjo

🧙
Disbelief in magic can force a poor soul into believing in govt and business
View GitHub Profile
@klugjo
klugjo / .jsx
Last active November 14, 2021 15:00
Listen to contentEditable div modifications in React
// TYPESCRIPT
import * as React from 'react';
export default class Editor extends React.Component {
private _root: HTMLDivElement; // Ref to the editable div
private _mutationObserver: MutationObserver; // Modifications observer
private _innerTextBuffer: string; // Stores the last printed value
public componentDidMount() {
this._root.contentEditable = "true";
@klugjo
klugjo / LinkedList.js
Last active February 16, 2020 18:21
LinkedList ES6 Implementation
class LinkedList {
constructor() {
this.head = null;
this.tail = null;
this.count = 0;
}
get length() {
return this.count;
}
@klugjo
klugjo / gulpfile.js
Last active February 16, 2022 13:14
Basic gulpfile.js for a static website with browser auto refresh
// Add our dependencies
var gulp = require('gulp'), // Main Gulp module
concat = require('gulp-concat'), // Gulp File concatenation plugin
open = require('gulp-open'), // Gulp browser opening plugin
connect = require('gulp-connect'); // Gulp Web server runner plugin
// Configuration
var configuration = {
paths: {
@klugjo
klugjo / gulpfile.js
Last active January 30, 2021 16:00
Basic gulpfile.js for a static website (HTML copy and CSS concatenation)
// Add our dependencies
var gulp = require('gulp'), // Main Gulp module
concat = require('gulp-concat'); // Gulp File concatenation plugin
// Configuration
var configuration = {
paths: {
src: {
html: './src/*.html',