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
| class CarryBack | |
| def initialize | |
| @buy_list = [] | |
| end | |
| def add_item(price) | |
| @buy_list.push price | |
| end | |
| def total |
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 app = angular.module("game", [], function($routeProvider, $locationProvider){ | |
| // $routeProvider.when("test", { | |
| // templateUrl: "index.html", | |
| // controller: MyCtrl2 | |
| // }); | |
| // $locationProvider.html5Mode(true); | |
| }); | |
| app.config(function($interpolateProvider){ | |
| $interpolateProvider.startSymbol('(('); |
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
| <!DOCTYPE HTML> | |
| <html lang="en-US" ng-app="game"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <script type="text/javascript" src="js/vendor/jquery-1.8.0.min.js"></script> | |
| <script type="text/javascript" src="js/angular.js"></script> | |
| <script type="text/javascript" src="js/objects.js"></script> | |
| <script type="text/javascript" src="js/index.js"></script> | |
| <script type="text/javascript" src="js/event.js"></script> | |
| <script type="text/javascript" src="js/map.js"></script> |
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
| $(document).ready(function() { | |
| var models = { | |
| names: ko.observableArray([ | |
| {"name": "name1"}, | |
| {"name": "name2"} | |
| ]) | |
| }; | |
| ko.applyBindings(models); | |
| setTimeout(function(){ |
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
| $(document).ready(function() { | |
| var models = { | |
| name: ko.observable("name") | |
| }; | |
| ko.applyBindings(models); | |
| setTimeout(function(){ | |
| models.name("HAHAHA"); | |
| }, 2000); | |
| }); |
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
| describe('design pattern', function () { | |
| var testData = null; | |
| it('observer', function(){ | |
| var Observer = function(){ | |
| this.subscribers = []; | |
| }; | |
| Observer.prototype = { | |
| publish: function(data){ | |
| var i = 0, | |
| len = this.subscribers.length; |
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
| describe('iterator', function() { | |
| it('test', function() { | |
| var Iter = function(data){ | |
| this.index = 0; | |
| this.data = data; | |
| }; | |
| Iter.prototype = { | |
| next: function(){ | |
| var elem = this.data[this.index]; | |
| this.index += 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
| describe('decorator', function() { | |
| // body... | |
| it('singleton1', function(done) { | |
| var Car = function(){ | |
| var instance = this; | |
| this.a = 100; | |
| Car = function(){ | |
| return instance; | |
| }; | |
| }; |
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 a = (function(){ | |
| return 100; | |
| }()); | |
| var b = { | |
| o: (function(){ | |
| var local = 100; | |
| return local * 2; | |
| }()) | |
| }; |
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 java.util.*; | |
| class EnumPractice{ | |
| private enum singleton{ | |
| INSTANCE; | |
| public void show(){ | |
| System.out.println("enum show"); | |
| } | |
| } |