Skip to content

Instantly share code, notes, and snippets.

View phranck's full-sized avatar
🖥️
Working from home

Frank Gregor phranck

🖥️
Working from home
View GitHub Profile
@fastjack
fastjack / Readme.md
Last active December 22, 2023 00:01
NeXT on Raspberry

Start with Raspberry OS 64 bit with graphical interface Install dependencies:

sudo apt-get install build-essential
sudo apt-get install libsdl2-dev libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libopenal-dev libaudiofile-dev libdbus-1-dev libdirectfb-dev cmake subversion zlib1g-dev libpng-dev

Checkout code:

svn checkout https://svn.code.sf.net/p/previous/code/trunk previous-code
// A URLSession extension that fetches data from a URL and decodes to some Decodable type.
// Usage: let user = try await URLSession.shared.decode(UserData.self, from: someURL)
// Note: this requires Swift 5.5.
extension URLSession {
func decode<T: Decodable>(
_ type: T.Type = T.self,
from url: URL,
keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy = .useDefaultKeys,
dataDecodingStrategy: JSONDecoder.DataDecodingStrategy = .deferredToData,
dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .deferredToDate
@SatoTakeshiX
SatoTakeshiX / SuperEllipse.swift
Created January 31, 2021 06:34
SuperEllipse
// Created by satoutakeshi on 2021/01/30 in MIT License
//
import SwiftUI
struct SuperEllipse: View {
var body: some View {
Image(systemName: "moon")
.resizable()
.frame(width: 100, height: 100)
@krzysztofzablocki
krzysztofzablocki / process.sh
Created January 18, 2021 11:29
3rd party tooling processing script
#!/bin/zsh
cd "$(dirname "$0")/.."
if [[ -n "$CI" ]] || [[ $1 == "--fail-on-errors" ]] ; then
FAIL_ON_ERRORS=true
echo "Running in --fail-on-errors mode"
ERROR_START=""
COLOR_END=""
INFO_START=""
@slightfoot
slightfoot / order_progress.dart
Last active July 1, 2023 16:02
Custom Order progress bar example - by Simon Lightfoot - 26/10/2020 - Using keys to access other parts of the UI in your RenderObject
// MIT License
//
// Copyright (c) 2020 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@verebes1
verebes1 / RealmCascadeDeletion.swift
Last active March 6, 2024 19:47
Realm Cascade Deletion in Swift
import RealmSwift
import Realm
protocol CascadeDeleting {
func delete<S: Sequence>(_ objects: S, cascading: Bool) where S.Iterator.Element: Object
func delete<Entity: Object>(_ entity: Entity, cascading: Bool)
}
extension Realm: CascadeDeleting {
func delete<S: Sequence>(_ objects: S, cascading: Bool) where S.Iterator.Element: Object {
@JohnSundell
JohnSundell / Podfile
Last active September 4, 2019 15:20
A Podfile that demonstrates how to use dependencies that use an older Swift version
target 'MyTarget' do
use_frameworks!
# Post installation script that enables the Swift 4.2 compiler's
# legacy 4.1 mode for 4.2-incompatible pods
post_install do |installer|
incompatiblePods = ['PodA', 'PodB']
installer.pods_project.targets.each do |target|
if incompatiblePods.include? target.name
@dasdennis
dasdennis / eOS_loki_perfect.bash
Last active May 31, 2019 00:09
Things to do after installing elementaryOS Loki 0.4
#!/bin/bash
# Download the last version of elementaryOS on https://elementary.io/ free or pay what you want ;)
# Organized by @dennissenner
# 2017-Jan-13, yeah, Friday 13th
# Download this script, edit if you want.
# To execute:
# sudo chmod +x -v eOS_loki_perfect.bash
# sudo ./eOS_loki_perfect.bash
@wojteklu
wojteklu / clean_code.md
Last active September 20, 2024 15:06
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

#! /bin/bash
cd ~
sudo apt-get update -y
sudo apt-get install clang libicu-dev binutils git -y
sudo apt-get install libcurl4-openssl-dev -y
sudo apt-get install libpython2.7 libpython2.7-dev -y
sudo apt-get install libmysqlclient-dev -y
wget https://swift.org/builds/swift-3.0-release/ubuntu1510/swift-3.0-RELEASE/swift-3.0-RELEASE-ubuntu15.10.tar.gz
tar zxf swift-3.0-RELEASE-ubuntu15.10.tar.gz
sudo mv swift-3.0-RELEASE-ubuntu15.10 /swift-3.0