Skip to content

Commit

Permalink
Another random codebase cleanup
Browse files Browse the repository at this point in the history
Important changes / new features:

- Rewritten in C# using the .NET Core 3 framework
- Updated layout & stylesheets
- Docker support
  • Loading branch information
dotWee committed Mar 7, 2020
1 parent b030c6b commit a4f1c2a
Show file tree
Hide file tree
Showing 79 changed files with 40,034 additions and 696 deletions.
256 changes: 46 additions & 210 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Created by https://www.gitignore.io/api/dotnetcore,aspnetcore,visualstudio,visualstudiocode
# Edit at https://www.gitignore.io/?templates=dotnetcore,aspnetcore,visualstudio,visualstudiocode
# Created by https://www.gitignore.io/api/git,macos,dotnetcore,aspnetcore,visualstudiocode
# Edit at https://www.gitignore.io/?templates=git,macos,dotnetcore,aspnetcore,visualstudiocode

### ASPNETCore ###
## Ignore Visual Studio temporary files, build results, and
Expand Down Expand Up @@ -282,6 +282,49 @@ __pycache__/
/wwwroot/node_modules


### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
Expand All @@ -293,211 +336,4 @@ __pycache__/
# Ignore all local history of files
.history

### VisualStudio ###
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser

# User-specific files (MonoDevelop/Xamarin Studio)

# Mono auto generated files
mono_crash.*

# Build results
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/

# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results

# NUnit
nunit-*.xml

# Build Results of an ATL Project

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_h.h
*.iobj
*.ipdb
*_wpftmp.csproj

# Chutzpah Test files

# Visual C++ cache files

# Visual Studio profiler

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace

# Guidance Automation Toolkit

# ReSharper is a .NET coding add-in

# JustCode is a .NET coding add-in

# TeamCity is a build add-in

# DotCover is a Code Coverage Tool

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Visual Studio code coverage results

# NCrunch

# MightyMoose

# Web workbench (sass)

# Installshield output folder

# DocProject is a documentation generator add-in

# Click-Once directory

# Publish Web Output
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted

# NuGet Packages
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files

# Microsoft Azure Build Output

# Microsoft Azure Emulator

# Windows Store app package directories and files
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
# but keep track of directories ending in .cache
!?*.[Cc]ache/

# Others

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)

# RIA/Silverlight projects

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.ndf

# Business Intelligence projects
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes

# GhostDoc plugin setting file

# Node.js Tools for Visual Studio

# Visual Studio 6 build log

# Visual Studio 6 workspace options file

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output

# Paket dependency manager

# FAKE - F# Make

# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# End of https://www.gitignore.io/api/dotnetcore,aspnetcore,visualstudio,visualstudiocode

WhatTheFuckShouldLukasHaveForLunch.Web/wwwroot/lib/
# End of https://www.gitignore.io/api/git,macos,dotnetcore,aspnetcore,visualstudiocode
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.Web/bin/Debug/netcoreapp2.2/WhatTheFuckShouldLukasHaveForLunch.Web.dll",
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/WhatTheFuckShouldLukasHaveForLunch.dll",
"args": [],
"cwd": "${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.Web",
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
Expand Down
34 changes: 31 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.Web/WhatTheFuckShouldLukasHaveForLunch.Web.csproj",
"${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.Web/WhatTheFuckShouldLukasHaveForLunch.Web.csproj",
"${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -32,11 +32,39 @@
"args": [
"watch",
"run",
"${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.Web/WhatTheFuckShouldLukasHaveForLunch.Web.csproj",
"${workspaceFolder}/WhatTheFuckShouldLukasHaveForLunch.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "docker-build",
"command": "docker",
"type": "process",
"args": [
"build",
"--rm",
"--pull",
"-t",
"whatthefuckshouldlukashaveforlunch",
"${workspaceFolder}"
],
"problemMatcher": []
},
{
"label": "docker-run",
"command": "docker",
"type": "process",
"args": [
"run",
"--rm",
"-it",
"-p",
"8080:80",
"whatthefuckshouldlukashaveforlunch"
],
"problemMatcher": []
}
]
}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# https://hub.docker.com/_/microsoft-dotnet-core
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source

# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# copy everything else and build app
COPY . ./
WORKDIR /source
RUN dotnet publish -c release -o /app --no-restore

# final stage/image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build /app ./
ENTRYPOINT ["dotnet", "WhatTheFuckShouldLukasHaveForLunch.dll"]
12 changes: 12 additions & 0 deletions Exceptions/MensaClosedException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace WhatTheFuckShouldLukasHaveForLunch.Exceptions
{
public class MensaClosedException : Exception
{
public MensaClosedException(string message): base(message)
{

}
}
}
18 changes: 18 additions & 0 deletions Helper/DateHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Globalization;

namespace WhatTheFuckShouldLukasHaveForLunch.Helper
{
public class DateHelper
{
private const string Format = "dd.MM.yyyy";

public static int TodaysDayOfYear = DateTime.Today.DayOfYear;

public static DateTime ParseDate(string value) => DateTime.ParseExact(value, Format, null);

public static int CurrentWeeknumber = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);

public static bool IsSameDay(DateTime date1, DateTime date2) => date1.DayOfYear == date2.DayOfYear;
}
}
Loading

0 comments on commit a4f1c2a

Please sign in to comment.