Skip to content

Instantly share code, notes, and snippets.

View murbanowicz's full-sized avatar
:octocat:

Marek murbanowicz

:octocat:
  • Urbanowicz DEV
  • Wrocław, Poland
View GitHub Profile
@murbanowicz
murbanowicz / states.ts
Created September 11, 2020 15:12
JavaScript / TypeScript enum for USA states, only state codes
enum States {
'AL' = 'AL',
'AK' = 'AK',
'AS' = 'AS',
'AZ' = 'AZ',
'AR' = 'AR',
'CA' = 'CA',
'CO' = 'CO',
'CT' = 'CT',
'DE' = 'DE',
@murbanowicz
murbanowicz / Dockerfile
Created April 8, 2020 12:16
NET Core + React + react-snap
FROM murbanowicz/net-core-react-builder AS builder
WORKDIR /build
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS final
WORKDIR /app
COPY --from=builder /app .
@murbanowicz
murbanowicz / package.json
Created April 8, 2020 12:11
React Snap config for Docker build
{
"dependencies": {},
"reactSnap": {
"puppeteerArgs": [
"--disable-setuid-sandbox", "--no-sandbox"
],
"concurrency": 1,
"inlineCss": false,
"puppeteerExecutablePath": "/usr/bin/chromium-browser"
}
@murbanowicz
murbanowicz / YourApp.csproj
Created April 8, 2020 11:58
React SPA Net Core
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<SpaRoot>frontend\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true"/>
</ItemGroup>
<ItemGroup>
@murbanowicz
murbanowicz / Startup.cs
Created April 8, 2020 11:55
SPA for Production NET Core
public void ConfigureServices(IServiceCollection services)
{
// ...
services.AddSpaStaticFiles(configuration => { configuration.RootPath = "frontend/build"; });
}
public void Configure(IApplicationBuilder app)
{
// ...
app.UseSpaStaticFiles();
public void Configure(IApplicationBuilder app)
{
app.UseSpa(builder =>
{
builder.Options.SourcePath = "frontend";
if (Environment.IsDevelopment())
{
builder.UseProxyToSpaDevelopmentServer("http://localhost:3001");
// builder.UseReactDevelopmentServer("start");
@murbanowicz
murbanowicz / webpack.config.js
Created February 9, 2019 15:40
Configuring Webpack 4 to work with Fomantic UI LESS
// right at the top of the file where you are declaring all other plugins
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
// ...
resolve: {
alias: {
"../../theme.config$": path.join(__dirname, "/semantic-ui/theme.config"),
"../semantic-ui/site": path.join(__dirname, "/semantic-ui/site")
}