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 () { | |
| if (document.documentElement.classList) { // html tag has no 'classList' property | |
| Object.defineProperty(HTMLElement.prototype, 'classList', { | |
| get: function () { | |
| return new function(node) { | |
| var self = node.className.trim().split(/\s+/); | |
| self.item = function (index) { | |
| return self[index]; | |
| }; |
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 () { | |
| "use strict"; | |
| if (typeof Function.prototype.bind !== 'function') { | |
| console.log('mimic Function.prototype.bind...'); | |
| /** | |
| * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind | |
| * | |
| * @param {object|null} ctx |
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
| require 'sinatra' | |
| get '/hello/:name' do |name| | |
| 'Hello, #{name}’ | |
| end |
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
| import cc.spray._ | |
| trait HelloService extends Directives { | |
| val helloService = { | |
| path("hello" / PathElement) { name => | |
| get { | |
| completeWith { “hello, “ + name } | |
| } | |
| } | |
| } |
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
| <script type="text/template" id="item-template"> | |
| <div class="view"> | |
| <input class="toggle" type="checkbox" <%= done ? 'checked="checked"' : '' %> /> | |
| <label><%- title %></label> | |
| <a class="destroy"></a> | |
| </div> | |
| <input class="edit" type="text" value="<%= title %>" /> | |
| </script> | |
| <script type="text/javascript"> | |
| var Todo = Backbone.Model.extend({ |
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
| <select data-bind="options: tickets, optionsCaption: 'Choose...', optionsText: 'name', value: chosenTicket"></select> | |
| <button data-bind="enable: chosenTicket, click: resetTicket">Clear</button> | |
| <p data-bind="with: chosenTicket"> | |
| You have chosen <b data-bind="text: name"></b> | |
| ($<span data-bind="text: price"></span>) | |
| </p> | |
| <script type="text/javascript"> |
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
| Ext.define('User', { | |
| extend: 'Ext.data.Model', | |
| fields: [ | |
| {name: 'name', type: 'string'}, | |
| {name: 'age', type: 'int'}, | |
| {name: 'pic', type: 'string'} | |
| ] | |
| }); | |
| var myStore = Ext.create('Ext.data.Store', { |
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
| package controllers; | |
| import play.*; | |
| import play.mvc.*; | |
| import views.html.*; | |
| public class Application extends Controller { | |
| public static Result index() { |
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
| package controllers | |
| import play.api._ | |
| import play.api.mvc._ | |
| object Application extends Controller { | |
| def index = Action { | |
| Ok(views.html.index("Hello, World!")) | |
| } |
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
| @(tasks: List[Task], taskForm: Form[String]) | |
| @import helper._ | |
| @main("Todo list") { | |
| <h1>@tasks.size task(s)</h1> | |
| <ul> | |
| @tasks.map { task => | |
| <li> | |
| @task.label |
OlderNewer