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
You must download the yui3-files (for every version you want to serve) as well as the Gallery-modules. | |
Yui3 --> http://yuilibrary.com/yui/quick-start/ or https://github.com/yui/yui3 | |
Gallery --> download zip from https://github.com/yui/yui3-gallery | |
The Gist presumes the next directory-structure on the server: | |
/usr/local/yui_libraries/ | |
/usr/local/yui_libraries/yui3/ | |
/usr/local/yui_libraries/yui3/3.10.3/... |
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
js | |
function doSomething(aNumber) { | |
if (typeof aNumber !== 'number') { | |
return Promise.reject(new TypeError('Expected a number')); | |
} | |
return somethingElse().then(...); | |
} |
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 promise1 = Promise.resolve('foo'); // a promise for the value ‘foo’ | |
var promise2 = new Promise(function (resolve) { | |
resolve(promise1); | |
}); | |
promise2.then(function (value) { | |
// value is ‘foo’ | |
}); |
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
YUI().require('some-es6-module', function (Y, imports) { | |
var foo = imports['some-es6-module'].foo; | |
}); |
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>Basic handlebars-helper-intl example</title> | |
<!-- Optional libraries, if older browser support required for Intl --> | |
<script src="./app/bower_components/intl/Intl.min.js"></script> | |
<!-- Required libraries --> | |
<!-- IntlMessageFormat library with the English language pack --> |
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 lang="en-US"> | |
<head> | |
<title>Dynamically including Intl.js</title> | |
<script> | |
// check to see if window.Intl exists. If not, include the polyfill | |
if (!window.Intl) { | |
var elem = document.createElement("script"); | |
elem.setAttribute("src", "http://yui.yahooapis.com/platform/intl/0.1.2/Intl.js"); | |
document.getElementsByTagName("head")[0].appendChild(elem); |
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> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"> | |
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"> | |
<style> | |
.app { | |
width: 300px; | |
margin: 0 auto; | |
} |
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
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css"> | |
<script src="http://yui.yahooapis.com/3.16.0/build/yui/yui-min.js"></script> |
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
<script> | |
YUI().use('app', function (Y) { | |
// Initial view: | |
Y.HomeView = Y.Base.create('homeView', Y.View, [], { | |
render : function () { | |
var html = '<h1>Scotch Regions</h1>'; | |
html += '<p><button class="pure-button">Cambletown</button>'; | |
// more html content | |
this.get('container').setHTML(html); |
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> | |
<!-- bower install handlebars handlbars-helper-intl, npm install intl-messageformat --> | |
<script src="./bower_components/handlebars/handlebars.js"></script> | |
<script src="./node_modules/intl-messageformat/build/intl-messageformat.en.min.js"></script> | |
<script src="./node_modules/intl-messageformat/locale-data/fr.js"></script> | |
<script src="./bower_components/handlebars-helper-intl/lib/helpers.js"></script> | |
<script id="template1" type="text/x-handlebars-template"> | |
{{#intl locales="en-US" }} |
OlderNewer