Skip to content

Instantly share code, notes, and snippets.


Matt McCray mattmccray

  • Elucidata unLTD
  • Dallas, TX
View GitHub Profile
Schniz / plaintext-contenteditable.css
Last active Apr 8, 2022
Plain-Text ContentEditable div for React.js
View plaintext-contenteditable.css
.comPlainTextContentEditable {
-webkit-user-modify: read-write-plaintext-only;
.comPlainTextContentEditable--has-placeholder::before {
content: attr(placeholder);
opacity: 0.5;
color: inherit;
cursor: text;
View memorySizeOfObject.js
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
case 'string':
petehunt / React sortable
Created Dec 9, 2013
Here's an example of React + jQuery UI sortable. The key thing to note is that we have the render() method do absolutely nothing and use componentDidUpdate() + React.renderComponent() to proxy updates through to the children. This lets us manage the DOM manually but still be able to use all the React goodies you know and love.
View React sortable
<script src=""></script>
<script src=""></script>
<link rel="stylesheet" href="" />
<script src=""></script>
<script src=""></script>
CanOfColliders /
Created Jul 15, 2013
Simple script to split a cubemap/skymap image produced by blender into 6 separated image files for use in Unity3Ds skybox materials.
#!/usr/bin/env python
# Will split a png cubemap/skymap image produced by blender into 6 separated image files for use in a skybox within unity
# Requires Python Imaging Library >
# The author takes no responsibility for any damage this script might cause,
# feel free to use, change and or share this script.
# 2013-07, CanOfColliders,
from PIL import Image
willurd /
Last active May 22, 2022
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
jdonaldson /
Last active Dec 15, 2015
Simple bash script for switching between haxe nightly and stable
export HAXE_NIGHTLY=$HOME/bin/haxe_nightly
if [ -z "$USE_HAXE_NIGHTLY" ] || $USE_HAXE_NIGHTLY; then
echo "Changing to Haxe stable version"
export USE_HAXE_NIGHTLY=false
echo "Changing to Haxe nightly at: $HAXE_NIGHTLY"
anonymous / 1_gridComponent.js
Created Feb 22, 2013
Grid Component
View 1_gridComponent.js
App.module("Dashboard", function(Dashboard, App, Backbone, Marionette, $, _){
"use strict";
var Comp = {};
// Grid Table Structure
// --------------------
Comp.GridRow = Marionette.ItemView.extend({
tagName: "tr"
View transition_sniffing.js
function whichTransitionEvent(){
var t;
var el = document.createElement('fakeelement');
var transitions = {
leemeichin /
Created Oct 9, 2012
Apply Standard Competition Rankings to your leaderboard

Standard Competition Rankings

This class makes it easier to generate a leaderboard that complies with the Standard Competition Ranking system. That is, it takes joint/tied positions into account, and adjusts the positions accordingly.

Take the following list of users and points for example:

User    | Points
1         35
2 35
abourget / directives.js
Created Aug 8, 2012
Hammer.js integration with AngularJS
View directives.js
* Inspired by AngularJS' implementation of "click dblclick mousedown..."
* This ties in the Hammer events to attributes like:
* hm-tap="add_something()"
* hm-swipe="remove_something()"
* and also has support for Hammer options with: