This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import m from 'mithril' | |
import store from '../../store' | |
import {loadUsers} from '../../data/users/actions' | |
import layout from '../../components/layout' | |
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require) | |
async function getJs(){ | |
return (await require('./users.js')).default | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var m = require( 'mithril' ) | |
var isSelected = require( '../functions/isSelected' ) | |
function action(option, selection, e){ | |
if (isSelected(ctrl.option, ctrl.selection)) { | |
var i = ctrl.selection.indexOf(ctrl.option) | |
ctrl.selection.splice(i, 1) | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// No dependencies! + 1 point | |
// Only one API to reference! + 1 point | |
const Widget = { | |
// Expose desired data directly using destructuring! + 1 point | |
controller({initialValue}) { | |
// No more retrieving references buried by the superclass! + 1 point | |
this.counter = initialValue; | |
// Two less methods! + 2 points | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var m = require('mithril'); | |
var layout = require('./components/layout/layout.js'); | |
m.route.mode = 'pathname'; | |
var Account = require('./models/account.model'); | |
authRoutes(document.getElementById('app'), '/', layout.wrap({ | |
'/': require('./pages/dashboard.js'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
numbers:['1','2','3','4'], | |
letters:['a','b','c','d'] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MODEL | |
'use strict'; | |
var m = require('mithril'); | |
module.exports = function get_himage(){ | |
return m.request({ | |
method: 'GET', | |
url: '/config.json' | |
}) | |
.then(function (data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m.validator = function (model, validations) { | |
this.errors = {} | |
this.validations = validations | |
this.model = model | |
} | |
m.validator.prototype.hasErrors = function () { | |
return Object.keys(this.errors).length | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mod = ( function initModulator(){ | |
if( !Map ){ | |
// A naive shim for maps functionality | |
var Map = shim; | |
var WeakMap = shim; | |
} | |
// Garbage collection flag | |
mod.cleanup = true; | |