Skip to content

Instantly share code, notes, and snippets.

View totocaster's full-sized avatar

Toto Tvalavadze totocaster

View GitHub Profile
@totocaster
totocaster / .gitconfig
Created June 2, 2014 15:35
My .gitconfig aliases. I will post more updates as I progress.
[alias]
ci = commit
co = checkout
st = status
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(blue)%h%C(reset) - %C(green)%ar%C(reset) %C(black)%s%C(reset) %C(dim black)[%an]%C(reset)%C(red)%d%C(reset)' --all # git log with lot of detail and tree-view
ll = log --pretty=format:'%C(blue)%h%Cred%d %Creset%s%Cblue %C(dim black)[%an]%C(reset)' --decorate # short and practical version of alias.lg
dfl = diff --cached HEAD^ #diff last commit
la = "!git config -l | grep alias | cut -c 7-" # list of all aliases, just to remember them all
@totocaster
totocaster / Preferences.sublime-settings
Last active December 12, 2017 01:21
Note to myself: current user settings for Sublime Text 3.
{
"added_words":
[
"blogs",
"blog",
"podcast",
"microblog",
"microblogging",
"smartwatches",
"microcontrollers",

Keybase proof

I hereby claim:

  • I am totocaster on github.
  • I am totocaster (https://keybase.io/totocaster) on keybase.
  • I have a public key whose fingerprint is CAD9 42FE 17F3 1FF5 670C C26C D5E6 155F DAA7 DF16

To claim this, I am signing this object:

@totocaster
totocaster / swifty-targetaction.swift
Last active January 3, 2016 07:24
Swift-y Target-Action (UIKit version)
// Swifty Target/Action
// Friday Q&A 2015-12-25
// https://www.mikeash.com/pyblog/friday-qa-2015-12-25-swifty-targetaction.html
import UIKit
class ActionTrampoline<T>: NSObject {
var action: T -> Void
init(action: T -> Void) {
self.action = action
import UIKit
public extension UIWindow {
public func flash() {
let flashView = UIView(frame: bounds)
flashView.userInteractionEnabled = false
flashView.backgroundColor = UIColor.whiteColor()
addSubview(flashView)
UIView.animateWithDuration(0.75, delay: 0.0, options: .CurveEaseOut, animations: {
@totocaster
totocaster / CustomView.swift
Created April 5, 2017 05:19
WIP: Custom UIView template for Xcode
class <#CustomView#>: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
@totocaster
totocaster / StringSanitize.swift
Last active June 6, 2023 09:00
Function that "sanitizes" string to safe filename string that can be used on Mac, Linux and Windows.
var str = "2018/12/06 12:28 \\ - Ourdoor Run: Making a habbit.fgworkout"
extension String {
func sanitized() -> String {
// see for ressoning on charachrer sets https://superuser.com/a/358861
let invalidCharacters = CharacterSet(charactersIn: "\\/:*?\"<>|")
.union(.newlines)
.union(.illegalCharacters)
.union(.controlCharacters)
@totocaster
totocaster / Fresh macOS Setup.md
Last active October 18, 2018 09:04
I have not updated macOS from fresh since 2009. In 2018 I plant to upgrade to new computer and want to start fresh. These are things that I think will make my life easier. This is living document and I'll be adding new items as I remember them.

Install Apps

...operational apps, in that order:
  • 1Password
  • Things
  • Setapp
  • Alfred
  • Backblaze
  • Bartender 3
@totocaster
totocaster / vscode-settings.json
Created December 20, 2017 12:57
VSCode User Settings
{
"editor.fontFamily": "Pragmata Pro",
"editor.fontSize": 12,
"editor.fontLigatures": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 80,
"terminal.integrated.fontFamily": "Pragmata Pro Mono",
#if swift(>=4.2)
import UIKit
extension UIEdgeInsets {
#warning("Xcode 10 UIEdgeInsets.zero fix present in codebase, remove when approprite.")
public static let zero = UIEdgeInsets()
}
#endif