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
function msToTime(duration) { | |
var milliseconds = parseInt((duration%1000)/100) | |
, seconds = parseInt((duration/1000)%60) | |
, minutes = parseInt((duration/(1000*60))%60) | |
, hours = parseInt((duration/(1000*60*60))%24); | |
hours = (hours < 10) ? "0" + hours : hours; | |
minutes = (minutes < 10) ? "0" + minutes : minutes; | |
seconds = (seconds < 10) ? "0" + seconds : seconds; |
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
app.config(function($routeProvider){ | |
$routeProvider | |
.when('/secretpage' ,{ | |
templateUrl: "templates/secretpage.html", | |
resolve:{ | |
"check":function(authService,$location){ //function to be resolved, accessFac and $location Injected | |
if(authService.isAuthenticated()){ //This happens before the page loads | |
//it's ok to see the content | |
}else{ | |
$location.path('/'); //redirect user to home if it does not have permission. |
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
using Microsoft.Owin.Hosting; | |
using System; | |
using System.Net.Http; | |
//Install-Package Microsoft.AspNet.WebApi.OwinSelfHost | |
namespace WebApi.SelfHosting.POC | |
{ | |
static class Program | |
{ | |
static void Main() | |
{ |
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
clock = sinon.useFakeTimers(new Date(2016,11,1).getTime()); | |
new Date(); //=> return the fake Date 'Sat Nov 01 2016 00:00:00' | |
clock.restore(); | |
new Date(); //=> will return the real time again (now) |
NewerOlder