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 / 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"
@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
class CrazyInteger
using IntegerRefinements
module IntegerRefinements
refine Integer do
def to_s
'TWO, ALWAYS TWO!!!!'
end
end
end
@mariozig
mariozig / bad_monkey.sh
Last active October 21, 2017 18:53
Bad idea to monkeypatch `.to_s` -- code for post: http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
irb(main):001:0> 1.class
=> Integer
irb(main):002:0> 1.to_s
=> "1"
irb(main):003:0> class Integer
irb(main):004:1> def to_s
irb(main):005:2> "two"
irb(main):006:2> end
irb(main):007:1> end
=> :to_s
@mariozig
mariozig / html_test.html
Created December 15, 2016 21:20 — forked from rwestergren/html_test.html
HTML Email Filter Test
<a onafterprint="console.log(244599)" onbeforeprint="console.log(309354)" onbeforeunload="console.log(879813)" onerror="console.log(949564)" onhashchange="console.log(575242)" onload="console.log(301053)" onmessage="console.log(976974)" onoffline="console.log(796090)" ononline="console.log(432638)" onpagehide="console.log(504345)" onpageshow="console.log(696619)" onpopstate="console.log(398418)" onresize="console.log(943097)" onstorage="console.log(882233)" onunload="console.log(929443)" onblur="console.log(932104)" onchange="console.log(102339)" oncontextmenu="console.log(761265)" onfocus="console.log(188946)" oninput="console.log(143653)" oninvalid="console.log(304208)" onreset="console.log(318472)" onsearch="console.log(778420)" onselect="console.log(942035)" onsubmit="console.log(603589)" onkeydown="console.log(650647)" onkeypress="console.log(579383)" onkeyup="console.log(821763)" onclick="console.log(284098)" ondblclick="console.log(477370)" ondrag="console.log(439095)" ondragend="console.log(546684)" o
require "http/client"
class Word
def initialize(word)
raise ArgumentError.new "Not a single word" if word.split(" ").size > 1
@word = word
end
def wiki_title
wiki_page = WikipediaPage.new(@word)