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
@mixin li-hover { | |
background: #3875d7; | |
color: #fff; | |
} | |
.autocomplete-input--select-drop { | |
background: white; | |
border: 1px solid #aaa; | |
margin-top: -1px; | |
position: absolute; |
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
(function () { | |
// | |
// Global ajax loaders | |
// | |
// This is useful for showing a loading animation, yet still taking | |
// advantage of the default behavior of m.request, which is to wait | |
// for all requests to complete before rendering the view. | |
// | |
// The loader is assumed to already be on the page | |
var loader = document.querySelector('.ajax-loader') |
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
window.Coupon = {} | |
Coupon.controller = function (attrs) { | |
var ctrl = this | |
ctrl.code = "" | |
ctrl.submit = function (e) { | |
e.preventDefault() | |
ctrl.error = null |
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.deferred.resolve = function (value) { | |
var deferred = m.deferred() | |
deferred.resolve(value) | |
return deferred.promise | |
} | |
m.deferred.reject = function (value) { | |
var deferred = m.deferred() | |
deferred.reject(value) | |
return deferred.promise |
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
(function (global) { | |
global.getProp = function (propName) { | |
return function (obj) { return obj[propName] } | |
} | |
global.queryProp = function (query) { | |
var segments = query.split('.') | |
return function (obj) { | |
var result = obj |
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
// NOTE: Requires Object.assign (you might need a polyfill) | |
Function.prototype.obind = function (ctx, obj) { | |
var f = this | |
var args = arguments | |
return function () { | |
arguments[0] = Object.assign(obj, arguments[0]) | |
return f.apply(ctx, arguments) | |
} | |
} |
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.callableComponent = function (componentObj) { | |
var componentFn = function (props, content) { | |
return m.component(componentFn, props, content) | |
} | |
if (componentObj) { | |
for (var prop in componentObj) { | |
componentFn[prop] = componentObj | |
} | |
} | |
return componentFn |
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
Widget = { | |
controller: function () { | |
this.css = Widget.stylesheet().classes | |
}, | |
view: function (ctrl) { | |
return m('.widget', [ | |
m('h3', { class: ctrl.css.head }), | |
m('div', { class: ctrl.css.body }) | |
]) | |
}, |
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
// English Example: | |
// Do your daily duties: | |
// Make me breakfast | |
// Do my laundry | |
// Walk my dog | |
// Make me breakfast: | |
// Turn on the stove | |
// Get out the eggs |
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
<html> | |
<head>Quizzy Part 1 MVC</head> | |
<body> | |
<div id="app"></div> | |
<script src="vendor/mithril.js" type="text/javascript"></script> | |
<script src="quiz.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
Quiz.vm.questions([ |