Skip to content

Instantly share code, notes, and snippets.


Matt McCray mattmccray

  • Elucidata unLTD
  • Dallas, TX
View GitHub Profile
View es6-feature-detection.js
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
} catch(e) {
alert('Your browser does not support ES6!')
pizzarob / 01_DropZone.jsx
Last active Nov 14, 2017
HTML5 Drag and Drop File Upload React Component
View 01_DropZone.jsx
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
class BatchDropZone extends React.Component {
static propTypes = {
kofifus / Codemirror spellchecker with typo corrections
Last active Sep 28, 2021
CodeMirror spell checker with typo correction
View Codemirror spellchecker with typo corrections
// include codemirror.js, addon/mode/overlay.js
// include async typo.js from
// include loadTypo.js from:
// loading typo + dicts takes a while so we start it first
// hosting the dicts on your local domain will give much faster loading time
// english dictionaries taken from
mweststrate / typeswitcher.ts
Created Apr 14, 2016
(TypeScript) typeswitcher, like switch, but with constructor based cases and expressions with inferred types
View typeswitcher.ts
* Usage:
typeSwitch(someInstance, defaultvalue)
.when(MyClass, i => result)
.when(OtherClass, i => otherResult)
In the expressions, the type of the 'i' param should be inferred correctly, see the attribute default value checks
export function typeSwitch<T, R>(instance: T, defaultValue?: R): TypeSwitcher<T, R> {
gaearon / reducers.js
Last active Dec 11, 2020
How I'd do code splitting in Redux (pseudo code, not tested!)
View reducers.js
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
cem2ran / main.js
Created Dec 28, 2015
React Getting Started - How it should be!
View main.js
import React from 'react'
import ReactDOM from 'react-dom'
const Hello = ({name}) => <h1>Hello {name}!</h1>
<Hello name={"vjeux"}/>,
libliflin / mithril_onerror.js
Last active Sep 15, 2017
Skip opening devtools when programming mithril
View mithril_onerror.js
error method makes it so i don't have to open up dev tools to see what went wrong.
must be in different <script> from your app code.
I use it in combination with Auto Reload
window.onerror = function(msg, url, line, col, error) {
m("html", [
m("body", [
m("table", [
gaearon / slim-redux.js
Last active May 18, 2022
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
View SimplePool.cs
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (
/// Latest Version:
/// License: CC0 (
/// 2015-04-16: Changed Pool to use a Stack generic.
/// Usage:
omgwtfgames / A set of Unity3D extension methods
Last active Apr 19, 2022
Some useful extension method for Unity3D
View A set of Unity3D extension methods
A collection of useful C# extension methods for the Unity engine.