Skip to content

Instantly share code, notes, and snippets.

View fabiogiolito's full-sized avatar
🏠
Working from home

Fabio Giolito fabiogiolito

🏠
Working from home
View GitHub Profile
@fabiogiolito
fabiogiolito / Typewriter.svelte
Created February 23, 2023 14:25
A Svelte component that types text like ChatGPT.
<script>
import { onMount } from "svelte";
// Text to display
export let text = "";
// <Typerwiter paused … /> to start paused
export let paused = false;
// <Typerwiter cursor … /> to show blinking cursor
<script>
import { fly } from "svelte/transition";
import { teleport } from "$lib/teleport";
export let isOpen = false;
// Usage
// <Dropdown up right>
// <button slot="trigger">Toggle</button>
// <div slot="menu">Content</div>
did:3:kjzl6cwe1jw146xqv0dh4zllis0314a7st0mbx1dd910m3dlgkisxie5vtfpknd
@fabiogiolito
fabiogiolito / mix.css
Created July 18, 2019 11:57
CSS override for Mix.com
.CardGrid {
width: 1280px !important;
height: auto !important;
margin: 0 auto;
display: grid !important;
grid-gap: 40px;
grid-template-columns: repeat(4, 290px);
grid-template-rows: auto;
align-items: stretch !important;
}
//
// InstaStories.swift
// SwiftUITests
//
// Created by Fabio Giolito on 23/06/2019.
// Copyright © 2019 Fabio Giolito. All rights reserved.
//
import Combine
import SwiftUI
@fabiogiolito
fabiogiolito / FacebookReactions.swift
Last active August 11, 2022 15:25
Recreating Facebook Reactions with SwiftUI. Demo Video: https://twitter.com/fabiogiolito/status/1142226669471748096
//
// FacebookReactions.swift
//
// Created by Fabio Giolito on 10/06/2019.
// Follow me: https://twitter.com/fabiogiolito
//
import SwiftUI
struct FacebookReactions : View {
//
// InstagramFeed.swift
// Landmarks
//
// Created by Fabio Giolito on 04/06/2019.
// Copyright © 2019 Apple. All rights reserved.
//
// ===================================================
// This is just a quick UI test.
//
// InstagramFeed.swift
// Landmarks
//
// Created by Fabio Giolito on 04/06/2019.
// Copyright © 2019 Apple. All rights reserved.
//
// ===================================================
// This is just a quick UI test.
extension UILabel {
func setLineSpacing(lineSpacing: CGFloat) {
let text = self.text
if let text = text {
let attributeString = NSMutableAttributedString(string: text)
let style = NSMutableParagraphStyle()
style.lineSpacing = lineSpacing
style.alignment = self.textAlignment
attributeString.addAttribute(NSAttributedString.Key.paragraphStyle, value: style, range: NSMakeRange(0, text.count))
self.attributedText = attributeString
let btn1 = StyledButton(text: "Regular")
let btn2 = StyledButton(text: "Tint primary wide", styles: [.tintPrimary, .wide])
let btn3 = StyledButton(text: "Primary large", styles: [.primary, .large])
let btn4 = StyledButton(text: "Large", styles: [.large])
let btn5 = StyledButton(text: "Label Button", styles: [.label, .tintPrimary])
let btn6 = StyledButton(text: "Secondary", styles: [.secondary])
let btn7 = StyledButton(text: "Tag", styles: [.tag])
let btn8 = StyledButton(text: "Vertical", image: UIImage(named: "circle"), styles: [.iconVertical, .tintSecondary])
let btn9 = StyledButton(text: "With icon", image: UIImage(named: "circle"), styles: [.iconHorizontal])
let btn10 = StyledButton(image: UIImage(named: "star"))