Skip to content

Instantly share code, notes, and snippets.

View fassko's full-sized avatar
👋
Hi! I'm Kristaps - Web3 and iOS Swift developer. Let's chat!

Kristaps Grinbergs fassko

👋
Hi! I'm Kristaps - Web3 and iOS Swift developer. Let's chat!
View GitHub Profile
import SwiftUI
struct BackgroundModifier: ViewModifier {
let colour: Color
func body(content: Content) -> some View {
ZStack {
colour
.edgesIgnoringSafeArea(.all)
content
@marco79cgn
marco79cgn / dm-toilet-paper.js
Last active February 29, 2024 17:35
iOS Widget, das die Anzahl an Klopapier Packungen in deiner nächsten dm Drogerie anzeigt (für die scriptable.app)
// dm Klopapier Widget
//
// Copyright (C) 2020 by marco79 <marco79cgn@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
/**
* Javascript module to construct and hash EIP-712 typed messages to be signed by private key.
* [EIP712]{@link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md} standard
*
* @author Ashwin Yardi
* @module eip712Signature
*/
const { padLeft, sha3 } = require("web3-utils");
const web3EthAbi = require("web3-eth-abi");
@bcnzer
bcnzer / getDownloadURL-example.js
Created February 9, 2020 09:41
Example of using the getDownloadURL method to check for a file's existance
// Using promise
const listRef = storage
.ref('screenshots/abc123.png')
.getDownloadURL()
.then((response) => {
// Found it. Do whatever
})
.catch((err) => {
// Didn't exist... or some other error
})
@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

//
// BottomSheetView.swift
//
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
//
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16
@stinger
stinger / CombineFetcher.swift
Last active January 28, 2023 18:07
Combine - fetching data using URLSession publishers
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@nicklockwood
nicklockwood / Withable.swift
Created January 28, 2019 12:06
Withable.swift
/// Withable is a simple protocol to make constructing
/// and modifying objects with multiple properties
/// more pleasant (functional, chainable, point-free)
public protocol Withable {
init()
}
public extension Withable {
/// Construct a new instance, setting an arbitrary subset of properties
init(with config: (inout Self) -> Void) {
@JohnSundell
JohnSundell / spm
Created August 25, 2018 18:14
A script that makes it easier to use the Swift Package Manager by making common commands less verbose 👍
#!/usr/bin/env bash
# Put this file in /usr/local/bin and then run chmod +x on it to make it executable
command=$1
shift
case $command in
"init" )
swift package init "$@"
@JohnSundell
JohnSundell / simrecord
Created March 16, 2018 21:05
🎥 Script that lets you start a video recording from the iOS simulator with one command
#!/bin/bash
ITERATION=1
EXTENSION="mp4"
FILENAME="$HOME/Desktop/Simulator Recording.$EXTENSION"
while [ -e "$FILENAME" ]
do
ITERATION=$((ITERATION+1))
FILENAME="$HOME/Desktop/Simulator Recording $ITERATION.$EXTENSION"