Skip to content

Instantly share code, notes, and snippets.

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

Pavel Ermakov pavermakov

🏠
Working from home
View GitHub Profile
@pavermakov
pavermakov / SnakeCase.swift
Last active May 6, 2021 09:20 — forked from dmsl1805/SnakeCase.swift
Camel case to snake case in Swift
extension String {
func camelCaseToSnakeCase() -> String {
let acronymPattern = "([A-Z]+)([A-Z][a-z]|[0-9])"
let normalPattern = "([a-z0-9])([A-Z])"
return self.processCamalCaseRegex(pattern: acronymPattern)?
.processCamalCaseRegex(pattern: normalPattern)?.lowercased() ?? self.lowercased()
}
fileprivate func processCamalCaseRegex(pattern: String) -> String? {
let regex = try? NSRegularExpression(pattern: pattern, options: [])
@pavermakov
pavermakov / WebViewAutoHeight.js
Created August 23, 2019 10:09 — forked from esamattis/WebViewAutoHeight.js
React native: Is it possible to have the height of a html content in a webview? http://stackoverflow.com/q/32952270
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Esa-Matti Suuronen <esa-matti@suuronen.org>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.