Skip to content

Instantly share code, notes, and snippets.

View klauslanza's full-sized avatar

Klaus Lanzarini klauslanza

  • Brescia
View GitHub Profile
@Dimon70007
Dimon70007 / Podfile
Created December 6, 2019 16:39
cocoapods Debug hook for project with many schemes and configurations
# targets with dependencies
# This is an alternative for manually specifying every configuration as :debug [link](http://guides.cocoapods.org/syntax/podfile.html#project).
# Because of cocoapods by default uses :release type for all configurations but Debug
# we need to change every configuration, named <configuration_name>.Debug
# at the bottom of file
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
@OdNairy
OdNairy / update_tf_data.rb
Last active June 2, 2019 19:43
Wait build to be processed and update changelog afterwards. fastlane 2.125+ required.
require 'spaceship'
module Fastlane
module Actions
module SharedValues
UPDATE_TF_CHANGELOG_CUSTOM_VALUE = :UPDATE_TF_CHANGELOG_CUSTOM_VALUE
end
class UpdateTfDataAction < Action
def self.run(params)
@nicklockwood
nicklockwood / Withable.swift
Created January 28, 2019 12:06
Withable.swift
/// Withable is a simple protocol to make constructing
/// and modifying objects with multiple properties
/// more pleasant (functional, chainable, point-free)
public protocol Withable {
init()
}
public extension Withable {
/// Construct a new instance, setting an arbitrary subset of properties
init(with config: (inout Self) -> Void) {
@mluisbrown
mluisbrown / FixBTSound.applescript
Last active June 8, 2023 19:02
AppleScript to set macOS audio input device to "Internal Microphone"
-- Sets your audio input source to "Internal Microphone"
-- Frequently needed if you use bluetooth headpohones and
-- run the Xcode iOS simulator, which will often set your
-- headphones to be the input device, resulting in a drastic
-- decrease in sound quality, and making it mono
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
end tell
@arturgrigor
arturgrigor / Podfile
Created September 10, 2018 09:55
Sample Podfile for silencing warnings for CocoaPods dependencies
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target '%TargetName%' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for %TargetName%
# pod 'FBSDKCoreKit'
end
@popmedic
popmedic / tldlist.swift
Last active March 7, 2021 10:26
a class with a static member with all top-level-domains
class TLDList {
static let tlds = [
"*.aaa",
"*.aarp",
"*.abarth",
"*.abb",
"*.abbott",
"*.abbvie",
"*.abc",
"*.able",
@cprovatas
cprovatas / Data+PrettyPrint.swift
Created May 23, 2018 15:52
Pretty print JSON string from Data in Swift 4.1 (especially useful printing to Xcode console)
import Foundation
extension Data {
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
}
protocol EnumDecodable: RawRepresentable, Decodable {
static func defaultDecoderValue() throws -> Self
}
enum EnumDecodableError: Swift.Error {
case noValue
}
extension EnumDecodable {
@damienlaughton
damienlaughton / UIAccessorizedTextField.swift
Created March 28, 2018 15:16
UIAccessorizedTextField is an iOS friendly alternative to the drop down list
//
// UIAccessorizedTextField.swift
// AccessorizedTextField
//
// Created by Damien Laughton on 28/03/2018.
// 2018 Mobilology Limited. No rights reserved.
//
import Foundation
import UIKit
@madebyollin
madebyollin / make_audiobook.py
Last active March 23, 2024 17:17
Converts an epub or text file to audiobook via Google Cloud TTS
#!/usr/bin/env python3
"""
To use:
1. install/set-up the google cloud api and dependencies listed on https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/texttospeech/cloud-client
2. install pandoc and pypandoc, also tqdm
3. create and download a service_account.json ("Service account key") from https://console.cloud.google.com/apis/credentials
4. run GOOGLE_APPLICATION_CREDENTIALS=service_account.json python make_audiobook.py book_name.epub
"""
import re
import sys