- Add a Boolean flag named
dom.webcomponents.enabled; set to true
This file contains hidden or 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
| // 1: how could you rewrite the following to make it shorter? | |
| bar['doSomething' + (foo?'':'Else')](el); | |
| // 2: what is the faulty logic in the following code? | |
| /* | |
| var foo = 'hello'; |
This file contains hidden or 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
| if(!Object.namespace) | |
| Object.namespace = function( str ){ | |
| if(!str) return; | |
| var i = 0 | |
| ,base = window | |
| ,shards,length | |
| if(str.indexOf("::") !== -1){ | |
| shards = str.split("::"); | |
| base = window[shards[0]] = window[shards[0]] || {}; |
This file contains hidden or 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() { | |
| function Game() { | |
| this.reset(); | |
| } | |
| Game.prototype = { | |
| reset: function reset() { | |
| this.count = 0; | |
| this.guesses = []; | |
| this.answer = Math.round(Math.random() * 99 + 1); | |
| }, |
This file contains hidden or 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
| [{"name":"root","type": "core/template", | |
| "children": [ | |
| {"name": "header","type": "core/template"}, | |
| {"name": "body","type":"core/template", | |
| "children": [ | |
| {"name": "body.left", "type": "core/template"}, | |
| {"name": "body.right", "type": "core/template"}, | |
| {"name": "body.main", "type": "core/template"} | |
| ] | |
| }, |
This file contains hidden or 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 protofy () { | |
| var args = Array.prototype.slice.call(arguments) | |
| return (function objectify (obj) { | |
| obj = args.shift() | |
| return args.length ? protofy.x( Object.create( objectify() ), obj ) : obj | |
| }()) | |
| } | |
| protofy.x = function ( one, two, k ) { |
This file contains hidden or 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 block = require('yayo/block') | |
| var fs = require('fs') | |
| function getTemplate(name) { | |
| return fs.readFileSync('./tmpl/'+name+'.tmpl', 'utf8') | |
| } | |
| var layout = new block({ | |
| template: getTemplate('layout') | |
| }) |
This file contains hidden or 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
| {block name='title'}{/block} | |
| {block name='body'}{/block} |
This file contains hidden or 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
| { | |
| "name": "block.name" | |
| ,"type": "core/text" | |
| ,"blocks": [ | |
| {"name": "some.block","type": "core/list"} | |
| ,{"name": "some.nested.block","type": "core/text"} | |
| ] | |
| } |
This file contains hidden or 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 Block = require('blocks/block') | |
| var TaskModel = require('app/blocks/task') | |
| var TaskBlock = Block.create({ | |
| template: "<input type=\"checkbox\" <%= this.model.get('doneness')?'checked':'' %>/><%= this.model.get('text') %>" | |
| }, { | |
| construct: function (taskId) { | |
| this.setModel(new TaskModel(taskId)) | |
| } | |
| }) |
NewerOlder