Skip to content

Instantly share code, notes, and snippets.

View totocaster's full-sized avatar

Toto Tvalavadze totocaster

View GitHub Profile
@totocaster
totocaster / README.md
Last active August 24, 2023 23:50
Capture bookmarklet I use for Obsidian.md

Based on original obsidian-web-clipper.js by @kepano.

I use simpler (almost note) organizational system so my captured notes are qiute sparce.

Sample Output

Below is sample how clipper collects selected text. File name is: 2023-08-25-F0848. F stands for fleeting.


{
"editor.fontFamily": "Input",
"editor.fontSize": 12,
"editor.fontLigatures": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.wordWrapColumn": 80,
"terminal.integrated.fontFamily": "Input",
@totocaster
totocaster / .lldbinit
Last active July 16, 2018 03:22
LLVM commands
### Reveal LLDB commands support - DO NOT MODIFY
command script import /Applications/Reveal.app/Contents/SharedSupport/Scripts/RevealServerCommands.py
###
# Run a command in objective C mode
command alias poc expression -l objc -o --
# Flush CAAnimation buffer
command alias caflush CATransaction.flush()
#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
@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",
@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 / 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 / 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()
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 / 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