This is still a work in progress, currently successfully authorises a user and exchanges that authorisation token for an access token.
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
| {-# LANGUAGE OverloadedStrings #-} | |
| module Lib | |
| ( recify, | |
| getAccessTokenFromPayload | |
| ) where | |
| import Web.Scotty | |
| import Network.HTTP.Types (status302) | |
| import Control.Monad.IO.Class |
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 'sb-bsd-sockets) | |
| ; Create an inet-socket instance | |
| (defparameter *socket* (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp)) | |
| ; Define our address to be 0.0.0.0 (public interface) | |
| (defparameter *address* '(0 0 0 0)) | |
| ; Define our port to be 8080 | |
| (defparameter *port* 8080) | |
| ; Connections to hold on the backlog | |
| (defparameter *socket-backlog* 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
| (require 'sb-bsd-sockets) | |
| ; Create an inet-socket instance | |
| (defparameter *socket* (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp)) | |
| ; Define our address to be 0.0.0.0 (public interface) | |
| (defparameter *address* '(0 0 0 0)) | |
| ; Define our port to be 8080 | |
| (defparameter *port* 8080) | |
| ; Connections to hold on the backlog | |
| (defparameter *socket-backlog* 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
| (defun pad(thing) | |
| (concatenate 'string "0" thing)) | |
| (defun pad-if-length-not-same(thing length) | |
| (cond | |
| ((not | |
| (= (length thing) length)) | |
| (pad thing)) | |
| (t thing))) |
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
| (defun pad(num) | |
| (concatenate 'string "0" num)) | |
| (defun should-pad(num) | |
| (= (length num) 1)) | |
| (defun apply-padding(num) | |
| (cond | |
| ((should-pad num) (pad num)) | |
| (t num))) |
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
| module DFASpec (spec) where | |
| import Test.Hspec | |
| data State = S1 | S2 deriving (Eq, Show) | |
| data Symbols = Zero | One deriving (Eq, Show) | |
| data Alphabet = Alphabet [Symbols] deriving (Eq, Show) | |
| data FiniteStates = FiniteStates [State] deriving (Eq, Show) | |
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
| #[derive(Debug, PartialEq)] | |
| enum Token { | |
| Symbol(Symbol), | |
| Type(Type), | |
| Keyword(Keyword), | |
| Word(Word), | |
| Char(char), | |
| } | |
| #[derive(Debug, PartialEq)] |
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 xyz.jacobclark.day3; | |
| import org.junit.Test; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import static org.junit.Assert.assertEquals; |
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
| const query = require('./query.js'); | |
| require('es6-promise').polyfill(); | |
| exports.handler = function(event, context, callback) { | |
| query(event["queryStringParameters"]['username']).then(function(data){ | |
| var resp = { | |
| "isBase64Encoded": false, | |
| "statusCode": 200, |