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, |
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 Main where | |
import Network.HTTP.Conduit | |
import qualified Data.ByteString.Lazy as L | |
import Text.Regex.PCRE | |
findNewsroundLinks :: String -> [String] | |
findNewsroundLinks = map read . getAllTextMatches . (=~ "href=\"/newsround([^\"#]+)") | |
bytestringToString :: L.ByteString -> [String] |
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; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
import static java.util.Arrays.asList; | |
public class LinearRegression { | |
private static final List<Integer> x = asList(2, 3, 5, 7, 9, 11, 14); // Consecutive hours developer codes |
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
def nn(input1, input2): | |
bias = 1 | |
weight0 = -1 | |
weight1 = 0.5 | |
weight2 = 0.5 | |
net = (bias*weight0)+(input1*weight1)+(input2*weight2) | |
return "1" if net >= 0 else "0" |