Skip to content

Instantly share code, notes, and snippets.

View mariozig's full-sized avatar

Mario Zigliotto mariozig

  • Intuit
  • San Mateo, CA
View GitHub Profile
@mariozig
mariozig / question2.swift
Created November 14, 2023 04:30
Question 2: Build an app to list coffee drinks and display a detail page for each
// 2 - Build an app to list coffee drinks and display a detail page for each
// API: https://api.sampleapis.com/coffee/hot
// Flow:
// - App launch
// - Land on index screen with listing (fetched from API above).
// - Tap on coffee, launch detail screen
// - Show detail screen with image, title, ingredients, description
// - Back button
//
//
@mariozig
mariozig / question1.swift
Last active November 14, 2023 04:29
Question 1: Given the following implementation, please produce a test suite for TemperatureManager
import Foundation
import XCTest
// Implementation
protocol TemperatureManagerDelegate: AnyObject {
func temperatureManager(_ temperatureManager: TemperatureManager, didUpdateTemperature temperature: Double)
}
class TemperatureManager {
weak var delegate: TemperatureManagerDelegate?
@mariozig
mariozig / migrate_repo.sh
Last active December 22, 2022 08:32
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@mariozig
mariozig / developer_machines.sh
Last active September 17, 2020 21:46
Changes to remote for developers. Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Go to local repo
cd /path/on/your/machine/my-repo
# Just update the remote
git remote set-url origin git@github.com:mario/my-repo.git
@mariozig
mariozig / eric.log
Created October 24, 2019 22:55
Eric Log
"Something went wrong." message on web. Console error. qbo_receipt_error : function=createTxnForReceipt, error={"intuit_receipt_tid":"e28bbb19-5246-4c11-80f6-398626863bc6","response":[{"$type":"/Result","error":{"code":"10000","type":"SYSTEM_ERROR","message":"An application error has occurred while processing your request","exceptional":false,"$sdk_provider":"com.intuit.qbo.servicev4.transactions.providers.TransactionProvider"},"errors":[{"code":"10000","type":"SYSTEM_ERROR","message":"An application error has occurred while processing your request","exceptional":false,"$sdk_provider":"com.intuit.qbo.servicev4.transactions.providers.TransactionProvider"}]}],"body":[{"$type":"/integration/StageEntity","id":"djQuMToxMjMxNDYzOTkzODAyNDk6MDg4YWZjNDczYQ:94b2ca90-f1e9-11e9-be7e-ab5d5db7ada1","state":"ACCEPTED_ADDED","transactionTrait":{"transactionSource":"RECEIPT_UPLOAD","fiDescription":"Sprouts","transaction":{"$type":"/transactions/Transaction","meta":{"createdByApp":{"name":"Receipt Upload"}},"id":"-1","header"
@mariozig
mariozig / emoji.swift
Last active July 26, 2019 16:28 — forked from hasanadil/gist:96bad711d6f71ec806f7
Good use of emoji
class 💩💩💩💩 {
func 💩💩💩(😎: Int, 🐯: Int) -> Int {
return 😎 + 🐯;
}
}
let 🐔 = 3;
let 😥 = 🐔 + 2;
let 💩 = 💩💩💩💩();
print(💩.💩💩💩(😎:🐔, 🐯:😥)); // => "8\n"
# Do not refactor, it is a bad practice. YOLO
# Not understanding why or how something works is always good. YOLO
# Do not ever test your code yourself, just ask. YOLO
# No one is going to read your code, at any point don't comment. YOLO
# Why do it the easy way when you can reinvent the wheel? Future-proofing is for pussies. YOLO
module IntegerRefinements
refine Integer do
def to_s
'TWO, ALWAYS TWO!!!!'
end
end
end
class CrazyInteger
using IntegerRefinements
@mariozig
mariozig / refinement_output.rb
Last active October 21, 2017 20:06
The result of using a refinement -- from post http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
# Our code calling `to_s` on an Integer has been refined
puts CrazyInteger.crazy_string(2)
# => "TWO, ALWAYS TWO!!!!"
puts CrazyInteger.crazy_string(3)
# => "TWO, ALWAYS TWO!!!!"
# Regular calls to Integer.to_s are still safe!
puts 1.to_s
# => "1"
puts 2.to_s
module IntegerRefinements
refine Integer do
def to_s
'TWO, ALWAYS TWO!!!!'
end
end
end