Skip to content

Instantly share code, notes, and snippets.

View mandrasch's full-sized avatar
🔍

Matthias Andrasch mandrasch

🔍
View GitHub Profile
@mandrasch
mandrasch / images.html
Created November 20, 2019 10:04
oerworldmap Image carousel attribution with imagecodr.org
<html>
<head>
<body>
<div about='https://farm66.static.flickr.com/65535/47788057632_f998372e51_b.jpg'><a href='https://www.flickr.com/photos/ter-burg/47788057632/' target='_blank'>
<img xmlns:dct='http://purl.org/dc/terms/' href='http://purl.org/dc/dcmitype/StillImage' rel='dct:type' src='https://farm66.static.flickr.com/65535/47788057632_f998372e51_b.jpg' alt='Creative Commons Global Summit 2019 by Sebastiaan ter Burg, on Flickr' title='Creative Commons Global Summit 2019 by Sebastiaan ter Burg, on Flickr' border='0'/></a>
<br/>&quot;<a href='https://www.flickr.com/photos/ter-burg/47788057632/' target='_blank'>Creative Commons Global Summit 2019</a>&quot;&nbsp;(<a rel='license' href='https://creativecommons.org/licenses/by/2.0/' target='_blank'>CC BY 2.0</a>)&nbsp;by&nbsp;<a xmlns:cc='http://creativecommons.org/ns#' rel='cc:attributionURL' property='cc:attributionName' href='https://www.flickr.com/people/ter-burg/' target='_blank'>Sebastiaan ter Burg</a>
</div>
<div about='https://
#content textarea{
resize: vertical !important;
min-height:100px !important;
}
@mandrasch
mandrasch / Code.gs
Last active June 25, 2020 14:56
Copy YouTube channel video to Drive Spreadsheet (Google Apps Script), spreadsheet template: https://docs.google.com/spreadsheets/d/1LvF0iqeQQyoUc_NjiIYjTvYGtIMWIXFlTHUGhhYXZ5g/edit#gid=0
/**
* Original Source: https://developers.google.com/youtube/v3/code_samples/apps-script
* Custom modifications by Matthias Andrasch, CC0 https://creativecommons.org/publicdomain/zero/1.0/deed.de
* Button solution via: https://www.benlcollins.com/apps-script/google-sheets-button/
*
* Get URL, title, thumbnail from playlist or channel (via YouTube Data API)
* YouTube API data needs to be enabled in "resources" -> "Advanced google services"
*/
function retrieveChannelOrPlaylistVideos() {
@mandrasch
mandrasch / README.md
Last active September 25, 2023 10:39
DDEV for existing wordpress site (with DDEV hooks)

UPDATE 2021: Checkout https://github.com/programmieraffe/ddev-pull-wp

This tutorial is for existing wordpress sites, which you want to edit/develop locally with ddev. Use case: Maybe you have a child-theme or plugin stored in git and you want to test it with the actual wordpress website.

  1. Setup blank folder mylocalwpsite/, add .ddev/config.yaml
  2. Adjust Line 19 in config.yaml and change it to the actual live URL of your wp site
  3. Dump your sql-Database (e.g. phpMyAdmin), reimport it with ddev import-db (https://ddev.readthedocs.io/en/latest/users/cli-usage/#importing-a-database)
  4. Download all wordpress files via sftp/ssh in your local folder (or use plugins such as https://wordpress.org/plugins/backwpup/), except your git tracked files (child-theme or plugin e.g.)
  5. ddev start
@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:
@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 / .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 / .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 / .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 / 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