Skip to content

Instantly share code, notes, and snippets.

Christian Ehrhardt chrixian

Block or report user

Report or block chrixian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ebidel / mo_vs.proxy.js
Last active Feb 28, 2019
MutationObserver vs. Proxy to detect .textContent changes
View mo_vs.proxy.js
This demo shows two ways to detect changes to a DOM node `.textContent`, one
using a `MutationObserver` and the other using an ES2015 `Proxy`.
From testing, a `Proxy` appears to be 6-8x faster than using a MO in Chrome 50.
**Update**: removing the `Proxy` altogether speeds up the MO to be inline with the Proxy.
This has something to do with how the browser queues/prioritizes Proxies over MO.
paulirish /
Last active Sep 17, 2019
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.


Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
lena3rika / UIUtility.cs
Last active Jan 24, 2018
UIUtility class used in my Dropdown tutorials
View UIUtility.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class UIUtility : MonoBehaviour
//Adds GameObject -> UI -> Dropdown menu item that instantiates
//a new button and attaches a dropdown component.
mmj-the-fighter / ShadersLister.cs
Last active Oct 25, 2015
Unity3D Editor Script : Displays gameobjects linked to each shader present in a scene.
View ShadersLister.cs
//Copyright © 2015 Manoj M J
//All Rights Reserved
//Why I do copyright the code that I provide at
//( )
* ShadersLister.cs - Displays gameobjects linked to each shader present in a scene.
* It is useful for checking if the scene contains any unwanted shaders.
mmj-the-fighter / DropObject.cs
Last active Oct 25, 2015
Unity3D Editor Script: Moves selected object downwards till it touches the ground
View DropObject.cs
//Copyright © 2015 Manoj M J
//All Rights Reserved
//Why I do copyright the code that I provide at
//( )
* DropObject.cs - Moves selected object downwards till it touches the ground
* This is useful for placing 3d models on scene.
* TODO:Add Spherecast in addition to Raycast
esemwy /
Created Jun 10, 2015
Create DAZ Install Manager packages from zip or directory
import uuid
import os
from zipfile import ZipFile, is_zipfile
import sys
import time
from random import randint
import argparse
import re
fauxparse /
Created Jan 13, 2015
Sortable lists in < 100 LoC
class SortableList
constructor: (el) ->
@el = $(el)
down: (e) =>
top = @el.offset().top
@el.find(".sortable").each (i, el) ->
$el = $(el)
offset = $el.offset().top
chriscoyier /
Last active Sep 11, 2019
How WordPress Plugins Should Handle Front End Resources

How WordPress Plugins Should Handle Front End Resources

This is a WORK IN PROGRESS intended for fleshing out and feedback

It's very common for people to be unhappy with how a WordPress plugin adds front end resources to their site. If a plugin needs CSS, the plugin will add a <link> element to that CSS. If the plugin needs JavaScript, it will add a <script> to that JavaScript.

Plugins do this because it works. It's damn important for a WordPress plugin to work, even in adverse conditions. They rightfully want good ratings and little customer support.

But this comes at the cost of additional HTTP requests. In optimizing front end performance of a site, reducing the number of HTTP requests is a huge thing. Front end developers want to decide and control how front end resources are being handled, and WordPress plugins don't typically make this easy on them.

View ExtraMouseEvents.cs
using UnityEngine;
using UnityEngine.EventSystems;
public static class ExtraMouseEvents
/// <summary>
/// Right mouse-click
/// </summary>
/// <param name="handler">Handler.</param>
/// <param name="data">Data.</param>
View MouseInputModule.cs
// Replacement module for Standalone Input Module
// Up to date for Unity 4.6 beta 19
// Usage:
// -Remove the standalone module from your event system
// -Add this instead
// -Include ExtraMouseEvents.cs and IExtraMouseEventsHandler.cs
// -Implement IRightPointerClickHandler, IRightPointerDownHandler, IRightPointerUpHandler, IMiddlePointerClickHandler,
// IMiddlePointerDownHandler and/or IMiddlePointerUpHandler.
You can’t perform that action at this time.