Skip to content

Instantly share code, notes, and snippets.

// Run the given tasks and returns their streams
// This will also take care of any task dependencies
//
// This is basically a custom gulp task orchestartor.
//
// Written for this SO question: http://stackoverflow.com/q/28334314/796832
// Gist: https://gist.github.com/MadLittleMods/d4083d2ba35e2f850161
//
// Usage:
// gulp.task('all-txt', function() {
@MadLittleMods
MadLittleMods / App-react-flux-async-dependent-store-init.js
Last active August 29, 2015 14:20
Flux: Initialize from asynchronous storage with interdependent stores - `waitFor` async - The real solution to this problem would be to create a DAO/service to feed data into the store via actions.
import React from 'react';
import SomeStore from '../stores/SomeStore';
import AppActions from '../actions/AppActions';
function gatherSomeStoreState(props, state) {
return {
myRandomNumber: SomeStore.getRandomNumber()
};
}
@MadLittleMods
MadLittleMods / mypostcss.js
Last active August 29, 2015 14:20
A custom System.js plugin to load in post css. Usage: `import 'somestyles.css!mypostcss';`
// Based off of geelen's gists: https://github.com/systemjs/plugin-css/issues/22#issuecomment-89491851
import postcss from 'postcss';
import inlineComments from 'postcss-inline-comment';
import mixins from 'postcss-mixins';
import nestedcss from 'postcss-nested';
import cssvariables from 'postcss-css-variables';
//import autoprefixer from 'autoprefixer-core';
@MadLittleMods
MadLittleMods / Handles.DrawSolidHollowDiscArc.cs
Last active November 22, 2016 08:19
Custom Unity Handles - `HandlesExtensions.DrawSolidHollowDiscArc(...)` - Just like `Handles.DrawSolidDisc` but has a inner and outer radius for hollow discs: http://docs.unity3d.com/ScriptReference/Handles.DrawSolidDisc.html
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
using self = HandlesExtensions;
public class HandlesExtensions {
static PropertyInfo handlesHandleWireMaterial_PropertyInfo;

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
@MadLittleMods
MadLittleMods / TextAreaWithTabs.cs
Created May 20, 2015 04:23
Unity GUI text area: `MLMEditorGUI.TextAreaWithTabs(Rect position, string text)`
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
using self = MLMEditorGUI;
using System.Collections.Generic;
public class MLMEditorGUI : MonoBehaviour {
@MadLittleMods
MadLittleMods / wrap-with-html-if.js
Created July 24, 2015 21:02
Wrap some content with a tag without having to deal with the concat hell :P
// tag: '<a href="foo.html">'
//
// ex. usage: `wrapWithHtmlIf('<a href="foo.html">', 'Hello World', function() { return true });`
// output: '<a href="foo.html">Hello World</a>'
var wrapWithHtmlIf = function(tag, content, testCb) {
if(testCb()) {
return tag + content + '</' + tag.match(/<(\w*?)(?:\s|\>)/)[1] + '>';
}
return content;
@MadLittleMods
MadLittleMods / root-eslintrc.json
Created July 30, 2015 11:05
The .eslintrc I put at the root directory. A little bit flexible to allow for others code that gets checked out, etc.
{
"env": {
"browser": 1,
"es6": true,
"amd": true,
"node": true
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
@MadLittleMods
MadLittleMods / bling.js
Last active September 1, 2015 11:55
My version of bling.js, https://gist.github.com/paulirish/12fb951a8b893a454b32. ES6, a little bit encapsulated.
let $ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(names, fn) {
names.split(/\s/).forEach(function(name) {
this.addEventListener(name, fn);
}.bind(this));
// Keep the chaining going
return this;
};