Skip to content

Instantly share code, notes, and snippets.

@imownbey
imownbey / nsattributedstring-ext.swift
Created June 23, 2017 19:37
Truncate a AttributedString with something other than just "..."
import Foundation
import UIKit
extension NSAttributedString {
// Get the number of lines an attributed string takes
func lineCount(atSize size: CGSize) -> Int {
let attrs = self.attributes(at: 0, effectiveRange: nil)
guard let font = (attrs[NSFontAttributeName] as? UIFont) else {
return 0
}
@v0lkan
v0lkan / nginx.conf
Last active August 19, 2025 18:31
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx