Skip to content

Instantly share code, notes, and snippets.

Building stuff

Gio Lodi mokagio

Building stuff
View GitHub Profile
mokagio / Date+SyntaxSugar.swift
Created Jun 2, 2021
Swift Date with year, month, and day
View Date+SyntaxSugar.swift
extension Date {
static func with(calendar: Calendar = .current, year: Int, month: Int, day: Int) -> Date {
// Because the `calendar` value is non-nil, it's safe to force unwrap the `date` value
DateComponents(calendar: calendar, year: year, month: month, day: day).date!
mokagio / Fastfile
Created Mar 5, 2021
Fastlane, Ruby, constants, and functions
View Fastfile
# Proper version
lane :test do |options|
UI.message wrap_in_emoji("Hello, World!")
def wrap_in_emoji(string)
mokagio /
Last active Jun 11, 2020
Script to reproduce the behavior described in
# I run this only on macOS
set -ex
rm -rf $ROOT_DIR
mokagio /
Last active Aug 4, 2020
Markdown Footnote
Lorem ipsum dolor sit amet, consectetur adipiscing elit[<sup id="footnote-id">1</sup>](#fn1).

### Footnotes
1. <span id="fn1"></span> [_consectetur adipiscing elit_](#footnote-id). Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.


mokagio /
Last active Feb 14, 2019
How to do tables in GitHub flavoured Markdown


heading 1 | heading 2 | heading 3
--- | --- | ---
abc | bcd | cde
def | efg | fgh

becomes this:

mokagio /
Created Jan 16, 2019
Companies doing Good Stuff
  • Neybox health tracking apps
  • Stile give teachers tools to teach better STEMs
  • Chargefox help locate charge stations for electric cars
Action Shortcut
Add a Cc ⇧⌘c
Mark as unread ⇧u
Undo z
mokagio / SimpleDataSource.swift
Created May 18, 2018
Ready made `UITableViewDataSource` for those simple scenarios in which you want to display homogeneous data, of type `T`, in a single section, on a standard `UITableViewCell`
View SimpleDataSource.swift
// swift version 4.1
import UIKit
/// Ready made `UITableViewDataSource` for those simple scenarios in which you want to display
/// homogeneous data, of type `T`, in a single section, on a standard `UITableViewCell`.
class SimpleDataSource<T>: NSObject, UITableViewDataSource {
typealias Item = T
let data: [T]
mokagio / sort-tests.rb
Created Nov 28, 2017
Script used to get the slowest tests from Xcode as part of the Code Quality Challenge
View sort-tests.rb
# Run your tests in Xcode, copy the result in the console in a file, the run
# cat your_file | ruby sort-tests.rb
report =
times = report.lines
.select { |l| l.match(/Test Case .* \((\d*\.\d*) seconds\)/).nil? == false }
.map do |m|
mokagio / bootstrap
Created Nov 22, 2017
CQC day 8 bootstrap script
View bootstrap
# Setup your local copy of the app. Run this script immediately after cloning
# the codebase.
set -eo pipefail
# First ensure all the required tools are available