Skip to content

Instantly share code, notes, and snippets.

View btastic's full-sized avatar

Ben Konsemüller btastic

View GitHub Profile
@btastic
btastic / clean_code.md
Created May 15, 2018 23:01 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@btastic
btastic / remove-docker-containers.md
Created July 3, 2018 08:00 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)
@btastic
btastic / New-DotNet.ps1
Last active October 11, 2018 22:19
A simple script to generate a new dotnet project with a default project hierarchy
param(
[Parameter(Mandatory = $true)]
[string]$ProjectName,
[Parameter(Mandatory = $true)]
[string]$SolutionName,
[Parameter(Mandatory = $true)]
[string]$DotNetTemplateName
)
$ErrorActionPreference = "Stop"
@btastic
btastic / main.dart
Created May 15, 2019 20:24
Repro flutter_native_image repro 47
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:flutter_native_image/flutter_native_image.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:flutter_native_image/flutter_native_image.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
// reference commercetools.NET.SDK via nuget
using System;
using System.Threading.Tasks;
using commercetools.Categories;
using commercetools.Common;
using commercetools.ProductProjections;
using commercetools.ProductProjectionSearch;
using commercetools.Products;
using commercetools.Products.UpdateActions;
@btastic
btastic / VideoExtensions.cs
Created July 6, 2020 21:49
Get chapters from youtube explode
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AngleSharp.Dom;
using AngleSharp.Html.Dom;
using YoutubeExplode;
const std::string moveCodes[18] = {
"R",
"L",
"B",
"F",
"U",
"D",
"R2",
"L2",
"B2",
@btastic
btastic / gist:4bd8e78a107d8733f802168398a506a3
Created September 30, 2022 09:44
DutchDudes Automatic Bed Selection (fixed)
[gcode_macro _LOAD_MESH_TEMP]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(0)|int %}
{% set FORCE = params.FORCE|default(0)|int %}
{% set SAVE = params.SAVE|default(0)|int %}
{action_respond_info("- AUTOMATED BED MESH GENERATOR -")}
{% if BED_TEMP|int < 30 %}
{action_respond_info("Your bed temp is to low, make sure it is at least 30 or higher")}
{% else %}
/* Magic Mirror
* Module: MMM-GoogleCalendar
*
* adaptation of MM default calendar module for Google Calendar events
* MIT Licensed.
*/
Module.register("MMM-GoogleCalendar", {
// Define module defaults
defaults: {
maximumEntries: 10, // Total Maximum Entries