Skip to content

Instantly share code, notes, and snippets.

View mandrasch's full-sized avatar
🟩
Open for Work

Matthias Andrasch mandrasch

🟩
Open for Work
View GitHub Profile
@mandrasch
mandrasch / creation.log
Created December 9, 2023 12:38
codespaces - no docker available in postCreateCommand
2023-12-09 12:36:42.373Z: Running the postCreateCommand from devcontainer.json...
2023-12-09 12:36:42.385Z: chmod +x ./.devcontainer/postCreateCommand.sh && ./.devcontainer/postCreateCommand.sh
2023-12-09 12:36:42.584Z: + ddev config global --omit-containers=ddev-router
2023-12-09 12:36:52.200Z: ERRO[0009] app.FindContainerByType(web) failed
2023-12-09 12:36:52.224Z: ERRO[0009] app.FindContainerByType(web) failed 2023-12-09 12:36:52.228Z:
2023-12-09 12:36:52.231Z: {"outcome":"error","message":"Command failed: /bin/sh -c chmod +x ./.devcontainer/postCreateCommand.sh && ./.devcontainer/postCreateCommand.sh","description":"The postCreateCommand in the devcontainer.json failed.","containerId":"330d4bf98029657829e51737275d1f5ed14f7524c1accfd7ce856ed61c155f41"}
2023-12-09 12:36:52.242Z: Could not connect to a Docker provider. Please start or install a Docker provider.
For install help go to: https://ddev.readthedocs.io/en/latest/users/install/
2023-12-09 12:36:52.253Z: postCreateCommand failed with exit code 1.
@mandrasch
mandrasch / test.js
Last active March 6, 2023 15:58
JSON.stringify with nested objects
var o1 = [{
"name":"string",
"active":"bool",
"data":[{
"value":"number",
"date":"string"
},{
"value":"number2",
"date":"string2",
"children":[
@mandrasch
mandrasch / Docker
Created February 17, 2023 10:05
Docker fix for M1
# Fix for https://github.com/andreabisello/pa11y-dashboard-docker-container
# based on https://stackoverflow.com/a/71452266, currently fails with
# "no such service: database"
FROM node:15.7.0-stretch-slim
# Dependencies are required to run puppeteer
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y libnss3 libgconf-2-4 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget net-tools git
# old
# RUN git clone https://github.com/pa11y/dashboard.git && cd dashboard && npm i
@mandrasch
mandrasch / build-deploy.yaml
Last active January 29, 2023 08:38
Github Pages env var for SvelteKit (WIP)
# .github/workflows/build-deploy.yaml
name: Build and Deploy
on:
push:
branches:
- main
# Sustainability: Don't trigger build for updated README
paths-ignore:
- '**/README.md'
# Allows you to run this workflow manually from the Actions tab.
@mandrasch
mandrasch / snippet_laravel.php
Created November 25, 2022 08:02
Browsersync JavaScript snippet
@env('local')
<script type='text/javascript' id="__bs_script__">
//<![CDATA[
document.write("<script async src='https://HOST:3000/browser-sync/browser-sync-client.js'><\/script>".replace("HOST", location.hostname));
//]]>
</script>
@endenv
@mandrasch
mandrasch / .htaccess
Last active December 17, 2024 06:58
.htaccess - fix http to https redirect for DDEV
# Debug trick, uncomment to check values:
# ErrorDocument 404 "Request: %{THE_REQUEST} Referrer: %{HTTP_REFERER}, Host: %{HTTP_HOST}, HTTPS: %{HTTPS}, HTTP:X-Forwarded-Proto: %{HTTP:X-Forwarded-Proto}"
# RewriteRule ^ - [L,R=404]
# The general rule for redirecting HTTP to HTTPS:
# --> Results in "Error too many redirects" in DDEV, because %{HTTPS} is always == off
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@mandrasch
mandrasch / .htaccess
Last active January 12, 2022 15:47
DDEV "ERR_TOO_MANY_REDIRECTS" because HTTPS is not available (because SSL proxy?)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@mandrasch
mandrasch / .eleventy.js
Last active October 21, 2024 08:10
Eleventy: Minify CSS and overwrite file (without inline integration)
module.exports = function (eleventyConfig) {
// npm install --save-dev clean-css
eleventyConfig.on('afterBuild', () => {
const CleanCSS = require("clean-css");
const fs = require('fs');
// Run me after the build ends
var inputFile = 'src/assets/css/main.css';
var input = fs.readFileSync(inputFile, 'utf8');
@mandrasch
mandrasch / ie11.js
Created June 25, 2021 11:53
Internet Explorer 11 detection vanillajs (IE11)
// IE 11 detection
// put it in head as first script, otherwise js errors won't prevent execution
// thanks to https://stackoverflow.com/a/65446599/809939
var ua = window.navigator.userAgent;
var trident = ua.indexOf('Trident/');
if (trident > 0) {
var rv = ua.indexOf('rv:');
console.log("Detected IE " + parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10));
@mandrasch
mandrasch / main.yml
Created February 7, 2021 10:55
Uberspace Github Action rsync
# /.github/workflows/main.yml
# Warning: deletes all files on uberspace which are not in repo, use without --delete if unsure
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps: