Skip to content

Instantly share code, notes, and snippets.

View swiftyfinch's full-sized avatar
🏖️
On vacation

Vyacheslav Khorkov swiftyfinch

🏖️
On vacation
View GitHub Profile
@botimer
botimer / yesno.rb
Created June 7, 2012 19:56
Handy yes/no prompt for little ruby scripts
# This is a reasonably well-behaved helper for command-line scripts needing to ask a simple yes/no question.
# It optionally accepts a prompt and a default answer that will be returned on enter keypress.
# It keeps asking and echoes the answer on the same line until it gets y/n/Y/N or enter.
# I tried to get Highline to behave like this directly, but even though it's sophisticated, I didn't like the result.
# This isn't especially elegant, but it is straightforward and gets the job done.
require 'highline/import'
def yesno(prompt = 'Continue?', default = true)
a = ''
s = default ? '[Y/n]' : '[y/N]'
@a13xb
a13xb / Podfile
Created January 11, 2016 12:21
Quick workaround for per-target asset catalog compilation using a Podfile post_install hook
# ...
# Workaround for https://github.com/CocoaPods/CocoaPods/issues/1546
post_install do |installer|
installer.aggregate_targets.each do |at|
files = at.user_targets.map{|t|
t.resources_build_phase.files_references.select{|f|
f.last_known_file_type == 'folder.assetcatalog'
}.map{|f|
Pathname.new(f.real_path).relative_path_from(f.project.path.dirname)
@wojteklu
wojteklu / clean_code.md
Last active July 23, 2024 21:23
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@sahara-ooga
sahara-ooga / HaveXcode9RenderMarkdown.md
Created November 26, 2017 09:18
Have Xcode 9 render markdown

Have Xcode 9 render markdown

To make Xcode 9 render markdown file eg. README.md, drop .xcodesamplecode.plist in your .xcodeproj/ folder. .xcodesamplecode.plist is like this:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array/> </plist>

For convenience, There is this tool, which is derived from a tutorial.

@terabyte
terabyte / amazon.md
Created December 6, 2017 02:27
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@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) {
#-------------------------------------------------------------------------------
# CocoaPods
#-------------------------------------------------------------------------------
function pods_install() {
red="\001$(tput setaf 1)\002"
yellow="\001$(tput setaf 3)\002"
green="\001$(tput setaf 2)\002"
reset="\001$(tput sgr0)\002"
if [ "$1" = "-f" ] ; then

Enable indexing

  • defaults delete com.apple.dt.Xcode IDEIndexEnable
  • defaults write com.apple.dt.Xcode IDEIndexEnable -bool YES

Disable indexing

  • defaults delete com.apple.dt.Xcode IDEIndexDisable
  • defaults write com.apple.dt.Xcode IDEIndexDisable -bool YES

Show Indexing numeric progress

  • defaults write com.apple.dt.Xcode IDEIndexerActivityShowNumericProgress -bool YES
🌞 Morning 65 commits ███▏░░░░░░░░░░░░░░░░░ 15.1%
🌆 Daytime 122 commits █████▉░░░░░░░░░░░░░░░ 28.3%
🌃 Evening 182 commits ████████▊░░░░░░░░░░░░ 42.2%
🌙 Night 62 commits ███░░░░░░░░░░░░░░░░░░ 14.4%
@ryanlintott
ryanlintott / LayoutThatFits.swift
Last active December 8, 2023 15:14
An alternative to ViewThatFits. Updated version can be found here: https://github.com/ryanlintott/LayoutThatFits
//
// LayoutThatFits.swift
// WWDC22Experiments
//
// Created by Ryan Lintott on 2022-06-08.
//
import SwiftUI
struct LayoutThatFits: Layout {