Skip to content

Instantly share code, notes, and snippets.

View deebloo's full-sized avatar

Danny Blue deebloo

View GitHub Profile
class MySelectElement extends HTMLElement {
constructor() {
const observer = new MutationObserver((records) => {
for (let record of records) {
treshugart / example.jsx
Last active May 6, 2024 04:53
Give yourself full control over the DOM that any hyperscript VDOM style function creates
import hify from './create-element';
import React from 'react';
import { render } from 'react-dom';
const h = hify(React.createElement.bind(React));
class Test extends HTMLElement {
static observedAttributes = ['attr']
attributeChangedCallback (name, oldValue, newValue) {
this.innerHTML = `Hello, ${this.getAttribute('attr')}!`;

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

kolemannix / TaggedPlayJsonExample.scala
Last active November 15, 2016 13:58
Dynamically sanitizing Strings (XSS concerns) based on type tags
import scalaz.{ @@, Tag }
import org.apache.commons.lang.StringEscapeUtils
import org.joda.time.DateTime
import play.api.libs.json._
trait DomRenderable
def RenderableString(s: String): String @@ DomRenderable = Tag[String, DomRenderable](s)
deebloo / web-component-class-example.js
Last active December 28, 2017 05:29
Its extremely easy to create vanilla custom elements with classes and template strings.
'use strict';
class NameCard extends HTMLElement {
set name(val) {
this._name = val;
get name() {
return this._name;
deebloo / web-component.js
Last active January 4, 2021 12:34
A pattern for creating vanilla web components. no library. just a pattern I am rolling around.
(function () {
expose('createMyComponent', register, factory);
* Exposes your new component to the window or to a module
* @param {string} name - the factory name to expose
* @param {function} definition - the definition of your web component. registers to the document
* @param {function} factory - method for programmatically creating web component
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
* To apply this patch load/bundle this file with your application and add a