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
// public serves static assets such as CSS and JavaScript to clients. | |
func public() http.Handler { | |
return http.StripPrefix("/public/", http.FileServer(http.Dir("./public"))) | |
} |
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
func TestIndex(t *testing.T) { | |
req, err := http.NewRequest(http.MethodGet, "/", nil) | |
if err != nil { | |
t.Fatalf("TestIndex: couldn't create HTTP GET request: %v", err) | |
} | |
rec := httptest.NewRecorder() | |
index().ServeHTTP(rec, req) |
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
FROM elixir:1.11.1-alpine AS build | |
# install build dependencies | |
RUN apk add --no-cache build-base npm git | |
# prepare build dir | |
WORKDIR /app | |
# install hex + rebar | |
RUN mix local.hex --force && \ |
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
String updateGuessState(String correctWord, String guessState, String guess) { | |
// Update the guess state to account for the latest guessed letter. | |
var newGuessState = ''; | |
for (var i = 0; i < correctWord.length; i++) { | |
if (correctWord[i] == guess) { | |
newGuessState += guess; | |
} else { | |
newGuessState += guessState[i]; | |
} | |
} |
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
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MainApp()); | |
} | |
class MainApp extends StatelessWidget { | |
const MainApp({super.key}); |
OlderNewer