Skip to content

Instantly share code, notes, and snippets.

View Munter's full-sized avatar

Peter Müller Munter

View GitHub Profile
@Munter
Munter / fusile-intro.md
Last active August 29, 2015 14:16
Work in progress Fusile description
npm install -g fusile

General usage: fusile <sourceDir> <mountPoint>

Fusile is a compiling file system proxy. In order to get it to compile your assets you need to install one or more of these precompilers: LiveScript, babel, coco, coffee-script, dogescript, less, marked, myth, node-sass, stylus, swig

When any of the above precompilers are available in the context of fusile (in your project root or globally installed), fusile will automatically load it and start compiling files with the corresponding file extension when you read the files from the mountpoint.

Guessing --root from input files: file:///home/munter/git/test-sprite/
✔ 0.001 secs: logEvents
✔ 0.001 secs: registerRequireJsConfig
✔ 0.005 secs: registerLabelsAsCustomProtocols
✔ 0.087 secs: loadAssets
✔ 0.008 secs: populate
✔ 0.001 secs: assumeRequireJsConfigHasBeenFound
✔ 0.018 secs: populate
✔ 0.000 secs: fixBaseAssetsOfUnresolvedOutgoingRelationsFromHtmlFragments
✔ 0.001 secs: assumeThatAllHtmlFragmentAssetsWithoutIncomingRelationsAreNotTemplates
@Munter
Munter / containedIn.js
Created December 15, 2014 17:50
Function check if an object is contained as a subset within another object
function containedIn(subset, set) {
if (typeof subset !== 'object') {
return subset === set;
} else {
return Object.keys(subset).every(function (key) {
return (key in set) && containedIn(subset[key], set[key]);
});
}
}
@Munter
Munter / index.html
Created December 8, 2014 10:41
Firefox v34 flexbox auto width bug
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>flexbox firefox v34</title>
<style>
.flexy {
display: flex;
flex-direction: row;
.ie .app-view {
.app-sidebar__content,
.app-view__content,
.app-wrapper__content {
// The 0px is a hack for IE10. Setting auto will make IE10 set the height of the content rather than the remaining height of the container
@include flex-basis(0px);
}
}
@Munter
Munter / buildFromWeb.js
Created November 25, 2014 23:40
Example script of how to do a production build of a website with external assets directly to disc
var AssetGraph = require('assetgraph-builder');
var graph = new AssetGraph({ root: 'https://raw.githubusercontent.com/saulshanabrook/hamilton-energy/gh-pages/'});
graph
.logEvents()
.loadAssets([
'index.html',
'README.md'
])
@Munter
Munter / scrollToMin.js
Created November 7, 2014 17:41
A function to find the minimum scrollTop offset to scroll the given element into view of its scrolling ancestor.
define(function (require) {
function findScrollParent(el) {
return $(el).scrollParent()[0]; // FIXME: scrollParent adds a jquery UI dependency
}
return function (element, margin) {
if (!element instanceof HTMLElement) {
throw new Error('scrollToMin: First argument must be a DOM node');
}
Chromecast is connecting
Connected to 0/0 peers
Downloaded 0 Bytes (0 b/s) with 0 hotswaps
Uploaded 0 Bytes (0 b/s)
Potentially unhandled rejection [1] TypeError: Object [object Object] has no method 'start'
at /home/munter/git/peercast/node_modules/chromecast-player/chromecast-player.js:30:13
at init (/home/munter/git/peercast/node_modules/chromecast-player/node_modules/when/lib/makePromise.js:38:5)
at new Promise (/home/munter/git/peercast/node_modules/chromecast-player/node_modules/when/lib/makePromise.js:26:53)
at promise (/home/munter/git/peercast/node_modules/chromecast-player/node_modules/when/when.js:100:10)
at findDevice (/home/munter/git/peercast/node_modules/chromecast-player/chromecast-player.js:17:10)
@Munter
Munter / jsx.js
Created August 3, 2014 19:52
Requirejs JSX transformer plugin. Works runtime and in r.js and lets you run without a file extension or with a custom one
define(function () {
'use strict';
var buildMap = {};
var transform = {
/**
* Reads the .jsx file synchronously and requires react-tools
* to perform the transform when compiling using r.js
@Munter
Munter / MyClass.js
Created July 17, 2014 08:55
An example of using self and bind()
function MyClass(otherInstance) {
var self = this;
self.options = {
loaded: false
};
setTimeout(function () {
self.options.loaded = true;