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
<form class="form-horizontal" method="POST" id="login-form" action="/Account/Login"> | |
<div class="control-group"> | |
<label class="control-label" for="userId">Email</label> | |
<div class="controls"> | |
<input id="userId" name="userId" data-bind="value: email" type="text" placeholder="Email"> | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="password">Password</label> | |
<div class="controls"> |
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 LoginFormViewModel | |
constructor: -> #from my many attempts, things works out best when you set them up from the constructor | |
@email= ko.observable("") | |
@pass= ko.observable("") | |
@logon= => #notice the fat arrow here | |
$.post '/Account/Login', | |
userId: @email() | |
password: @pass() | |
(data) -> $('body').append "Successfully posted to the page." |
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 class AccountModule : NancyModule | |
{ | |
private readonly IAuthenticationServiceClient m_authenticationService; | |
public AccountModule(IAuthenticationServiceClient authenticationService) | |
: base("/Account") | |
{ | |
m_authenticationService = authenticationService; | |
Post["/Login"] = args => | |
{ |
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 class BlogBootstrapper : AutofacNancyBootstrapper | |
{ | |
protected override void ApplicationStartup(Autofac.ILifetimeScope container, Nancy.Bootstrapper.IPipelines pipelines) | |
{ | |
base.ApplicationStartup(container, pipelines); | |
#if DEBUG | |
StaticConfiguration.DisableErrorTraces = false; | |
#endif | |
CookieBasedSessions.Enable(pipelines); |
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 class BloggerModule : SecureModule | |
{ | |
private readonly IBlogServiceClient m_blogService; | |
public BloggerModule(IBlogServiceClient blogService) | |
: base("/blog") | |
{ | |
m_blogService = blogService; | |
Get["/{Id}"] = parameters => | |
{ |
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 abstract class SecureModule : NancyModule | |
{ | |
protected SecureModule():this("") | |
{ | |
} | |
protected SecureModule(string path):base(path) | |
{ | |
this.ShouldBeAuthenticated(); | |
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 static class ModuleSecurity | |
{ | |
public static void ShouldBeAuthenticated(this NancyModule module) | |
{ | |
module.Before.AddItemToEndOfPipeline(ShouldBeAuthenticated); | |
} | |
private static Response ShouldBeAuthenticated(NancyContext context) | |
{ | |
Response response = null; |
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 akka.actor.{ActorSystem, Props, Actor, Inbox, ActorRef} | |
import scala.concurrent.duration._ | |
case class NoSoupForYou | |
case class OpenShop | |
case class CloseShop | |
case class CappucinoRequest | |
case class TeaRequest | |
case class Check(amount: Int) |
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.ComponentModel.Composition; | |
using System.ComponentModel.Composition.Hosting; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using OC.SchedulerInterface; | |
using System.ComponentModel.Composition.Primitives; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:background="@android:color/white" | |
android:paddingRight="2px" | |
android:paddingLeft="2px" | |
android:paddingBottom="2px" | |
android:paddingTop="2px"> |