Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Lukas Himsel lukas-h

🏠
Working from home
View GitHub Profile
View index.html
<!DOCTYPE html>
<html amphtml>
<head>
...
<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>
</head>
<body>
...
<amp-iframe
@lukas-h
lukas-h / amp-dsgvo-opt-in.md
Last active May 29, 2020
DSGVO-Banner Opt-in für AMP-Webseiten
View amp-dsgvo-opt-in.md

DSGVO-Cookie-Banner mit Opt-in für AMP

Nach der neuen DSGVO-Regelung müssen Websites, die Cookies verwenden einen explizites Opt-In machen.

Siehe hier: DSGVO-Entscheidung vom Bundesgerichtshof: Wer braucht jetzt einen Cookie-Banner?

Dies sollte als "Starthilfe" und nicht als vollständige Implementierung angesehen werden.

1. Schritt

Zu den amp-analytics-Tags muss der Parameter data-block-on-consent="_till_accepted" hinzugefügt werden.

@lukas-h
lukas-h / strptime.dart
Last active May 4, 2020
Ruby's date formatting method strptime(date, format) in Dart
View strptime.dart
import 'package:intl/intl.dart';
Map conversions = {
'a': (d) => 'E',
'A': (d) => 'EEEE',
'b': (d) => 'MMM',
'B': (d) => 'MMMM',
'+': (d) => _strptime(d, '%a %b %e %H:%M:%S %Z %Y'),
'%': (d) => '%%',
'Z': (d) => 'vvvv',
View le-nombre-d-or.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Le nombre d'or</title>
</head>
<body class="gr-column">
@lukas-h
lukas-h / formatRfc822.dart
Last active Apr 21, 2020
Dart DateTime DateFormat to RFC-822 String
View formatRfc822.dart
import 'package:intl/intl.dart';
import 'package:test/test.dart';
formatRfc822(DateTime d) {
var template = "EEE, dd MMM yyyy HH:mm:ss";
var out = DateFormat(template).format(d);
if (d.isUtc) {
out += ' GMT';
} else {
var offset = d.toLocal().timeZoneOffset.inHours * 100;
@lukas-h
lukas-h / csv_to_map.dart
Last active Apr 8, 2020
CSV to List<Map<String, String>> instead of the normal List<List<String>> scheme of the original csv package
View csv_to_map.dart
class CsvToMapConverter {
CsvToListConverter converter;
CsvToMapConverter(
{String fieldDelimiter = defaultFieldDelimiter,
String textDelimiter = defaultTextDelimiter,
String textEndDelimiter,
String eol = defaultEol,
CsvSettingsDetector csvSettingsDetector,
bool shouldParseNumbers,
bool allowInvalid}) {
@lukas-h
lukas-h / firebase.json
Created Dec 5, 2019
my firebase hosting config file
View firebase.json
{
"hosting": {
"public": "_site",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [{
"source": "**",
@lukas-h
lukas-h / getip.c
Last active May 9, 2020
Resolve IP as hostname (unix console tool)
View getip.c
/*
* `getip.c'
*
* Copyright (C) 2015, 2016 Lukas Himsel <lukas.himsel@web.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
@lukas-h
lukas-h / snippet.c
Created May 1, 2019
Snippet for allegro 4 game engine to create a basic 2d game
View snippet.c
/*
* snippet.c
*
* Copyright (C) 2015, 2016 Lukas Himsel <lukas.himsel@web.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@lukas-h
lukas-h / backup.sh
Created May 1, 2019
Backup your linux system harddrive
View backup.sh
#!/bin/sh
# Written by Lukas Himsel <lukas.himsel@web.de>
#
# -> backup your complete linux system <-
#
# Variables:
# BACKUP_DEVICE is the *mounted* harddrive for the backup
# BACKUP_DATE is the actual date and it's used to create a folder
# with the actual date
#
You can’t perform that action at this time.