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
| public override async Task OnOpened() { | |
| var t = new System.Timers.Timer(); | |
| // do your onOpen Stuff... | |
| t.Interval = 1000 * 15; | |
| t.Elapsed += (sender, args) => { | |
| this.Invoke(new { | |
| ts = DateTime.Now.Second | |
| }, "ping"); | |
| }; | |
| t.Start(); |
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 (!Array.prototype.find) { | |
| Array.prototype.find = function (predicate) { | |
| if (this === null) { | |
| throw new TypeError('Array.prototype.find called on null or undefined'); | |
| } | |
| if (typeof predicate !== 'function') { | |
| throw new TypeError('predicate must be a function'); | |
| } | |
| var list = Object(this); | |
| var length = list.length >>> 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
| $scope.myArray = []; | |
| for (var i = 1; i < 200;i++) { | |
| $scope.myArray.push({ | |
| id: i, | |
| firstName: (Math.random() * 9e6).toString(36), | |
| lastName: (Math.random() * 9e6).toString(36), | |
| city: (Math.random() * 9e6).toString(36), | |
| zipcode: i * 100, |
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 Watchers = { | |
| getWatchers : function(root) { | |
| root = angular.element(root || document.documentElement); | |
| function getElemWatchers(element) { | |
| var isolateWatchers = getWatchersFromScope(element.data().$isolateScope); | |
| var scopeWatchers = getWatchersFromScope(element.data().$scope); | |
| var watchers = scopeWatchers.concat(isolateWatchers); | |
| angular.forEach(element.children(), function (childElement) { | |
| watchers = watchers.concat(getElemWatchers(angular.element(childElement))); | |
| }); |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using System.Web; | |
| using XSockets.Core.Common.Socket; | |
| using XSockets.Core.Common.Utility.Logging; | |
| using XSockets.Core.XSocket.Helpers; | |
| using XSockets.Plugin.Framework; |
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
| private IEnumerable<FakeOrder> CallServiceToFind(string query) | |
| { | |
| System.Threading.Thread.Sleep(1000); | |
| return orders.Where(p => p.ProjectName.ToLower().Contains(query.ToLower())).Take(400); | |
| } | |
| private Task<IEnumerable<FakeOrder>> _task { get; set; } | |
| public async Task FindOrder(string query,int chunks = 10,int wait = 1000) | |
| { | |
| try | |
| { |
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
| // Skapa vår app | |
| angular.module("jonas.app", []); | |
| // the controller | |
| (function (angular) { | |
| var myController = function($scope,myService) { |
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
| MyControllers.PeerController =(function () { | |
| var randomString = function () { | |
| return Math.random().toString(36).substring(7); | |
| }; | |
| var chatMessage = function (text,nickname) { | |
| this.text = text; | |
| this.created = new Date(); | |
| }; |
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
| // location controllers/controller.js | |
| // this will store the messages and act as a fake db .-) | |
| var fakeDb = { | |
| messages : [] | |
| }; | |
| var ChatController = (function (db) { | |
| // find out who this message targets? |
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 { | |
| ThorIO,CanInvoke,ControllerProperties,CanSet | |
| } from "thor-io.vnext" | |
| // simple model | |
| class ChatMessage | |
| { | |
| text:string; | |
| } |