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
const THIS_YEAR = 2017; | |
const MAX_AGE = 123; | |
// https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes | |
function sieveOfErathosthenes(max) { | |
const notPrimes = []; | |
const top = Math.sqrt(max); | |
const primes = []; | |
for (let i = 2; i < top; i += 1) { |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Mithirl ES6 test</title> | |
<meta charset="UTF-8"> | |
<script src="http://cdn.jsdelivr.net/mithril/0.2.0/mithril.min.js"></script> | |
<script src="node_modules/babel-core/browser.js"></script> | |
</head> |
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
<!doctype html> | |
<html> | |
<head> | |
<title>YUI todo demo in Mithril</title> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.18/mithril.min.js"></script> | |
<script src="../../node_modules/htmlparser-jresig/htmlparser-lib/htmlparser.js"></script> | |
<!-- This is the main container and "shell" for the todo app. --> | |
<script type="text/x-template" id="todo-app-template"> | |
<div id="todo-app"> |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Virtual DOM with node references</title> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.18/mithril.min.js"></script> | |
<script src="../../node_modules/htmlparser-jresig/htmlparser-lib/htmlparser.js"></script> | |
<!-- This is the main container and "shell" for the todo app. --> | |
<script type="text/x-template" id="todo-app-template"> | |
<div id="todo-app"> |
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
/* globals Mithril, console, document */ | |
(function (m) { | |
//controller | |
var app = function () { | |
// model initialization, if does not already exists | |
if (!app.list) { | |
app.list = m.request({ | |
method: 'GET', |
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
/* globals Mithril, console, document */ | |
(function (m) { | |
var app = { | |
//models | |
// I keep a static copy of the list in the app | |
// so it doesn't get reloaded each time the route changes | |
// and a new app instance gets initialized | |
list: 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
/** | |
Adds a style `width` setting to an associated `<col>` | |
element for the column. | |
Note, the assigned width will not truncate cell content, and | |
it will not preserve the configured width if doing so would | |
compromise either the instance's `width` configuration or | |
the natural width of the table's containing DOM elements. | |
If absolute widths are required, it can be accomplished with |
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
// First version: | |
var goto = function (where) { | |
return { | |
a: function () { | |
console.log('a'); | |
}, | |
b: function () { | |
console.log('b'); | |
} |
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
// How to use it. | |
// | |
// This code is based on the template file that YOGI produces for unit testing | |
// when a module is created. Only the main changes to it are listed. | |
// | |
// Add a reference to the module in the YUI configuration section so it can locate it | |
// It's up to you where you put it. | |
YUI({ | |
groups: { | |
leaks: { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<script type="text/javascript" src="http://yui.yahooapis.com/3.8.0/build/yui/yui.js"></script> | |
</head> | |
<body class="yui3-skin-sam"> | |
<script> | |
// Create a new YUI instance and populate it with the required modules. |
NewerOlder