Skip to content

Instantly share code, notes, and snippets.

View Bondifrench's full-sized avatar

Dominik Dumaine Bondifrench

View GitHub Profile
@Bondifrench
Bondifrench / browserify_for_webpack_users.markdown
Created October 26, 2017 05:21
browserify for webpack users

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

@Bondifrench
Bondifrench / tooltip.js
Created September 22, 2017 06:25 — forked from StephanHoyer/tooltip.js
tooltip component
'use strict';
function noop(){}
var contentView = noop;
var elPos = { left: 0, bottom: 0};
var tooltip = {
show: function(content, options) {
return function(event) {
@Bondifrench
Bondifrench / example.js
Created August 2, 2016 21:26 — forked from gilbert/example.js
Mithril.js - Avoiding m.props
// m.prop is a great pattern, but Plain-old JavaScript Objects (POJO) are
// much more pleasant to work with.
// Here's an example of using POJOs with one- and two-way data binding.
// First, the helper methods
m.setValue = function (obj, prop) {
return m.withAttr('value', function(value) { obj[prop] = value })
}
@Bondifrench
Bondifrench / component.js
Created July 24, 2016 01:37 — forked from flintinatux/component.js
Component wrapper for mithril 1.x. Registers lifecycle methods as streams, so that components may be contructed as single-closure factories that return view functions.
const m = require('mithril')
const stated = hook => vnode => vnode.state[hook](vnode)
const oninit = Comp => vnode => {
vnode.state.oncreate = m.prop()
vnode.state.onremove = m.prop()
vnode.state.view = Comp(vnode)
}
@Bondifrench
Bondifrench / multi.js
Created March 23, 2016 23:43 — forked from barneycarroll/multi.js
Execute multiple functions where one is expected. Useful for event handling.
function multi(){
var handlers = Array.prototype.filter.call( arguments, function( x ){
return x instanceof Function
} )
return function handle(){
for( var i = 0; i < handlers.length; i++ )
handlers[ i ].apply( this, arguments )
}
}
function auth(component) {
return {
controller: function () {
var ctrl = this;
function success(user) {
Account.user(user)
ctrl.output = new component.controller()
m.redraw(true)