Skip to content

Instantly share code, notes, and snippets.

View shmidt's full-sized avatar

Dima Shmidt shmidt

View GitHub Profile
@abbeycode
abbeycode / BonjourPublisher.swift
Last active January 18, 2019 06:39
A class to facilitate publishing a Bonjour service in Swift
//
// BonjourPublisher.swift
// BonjourTest
//
// Created by Dov Frankel on 10/12/15.
// Copyright © 2015 Dov Frankel. All rights reserved.
//
import Foundation
@kfix
kfix / iterm.jxa
Last active January 14, 2024 06:46
debugging iterm JS applescript window indexing failures
#!/usr/bin/osascript -l JavaScript
var iTerm = Application("iTerm");
iTerm.includeStandardAdditions = true;
iTerm.activate()
var new_win = function() {
var myNewWindow = iTerm.createWindowWithDefaultProfile({command: "/bin/bash"});
// https://github.com/gnachman/iTerm2/search?q=iTermNewWindowCommand
console.log("New window created: " + Automation.getDisplayString(myNewWindow, true));
return myNewWindow;
@rdougan
rdougan / CollectionViewListLayout.swift
Created September 29, 2015 10:42
A basic NSCollectionViewLayout subclass which displays NSCollectionView items in a list layout.
//
// CollectionViewListLayout.swift
// money
//
// Created by Robert Dougan on 29/09/15.
// Copyright © 2015 Phyn3t. All rights reserved.
//
import Cocoa
@alemar11
alemar11 / .lldbinit
Created September 28, 2015 21:36
Xcode lldbinit
# Swift
command alias uikit expr import UIKit
command alias foundation expr import Foundation
command alias vh expr -l objc++ -O -- [[[UIWindow keyWindow] rootViewController] _printHierarchy]
# Objective-C
command alias uikitc expr @import UIKit
command alias foundationc expr @import Foundation
command alias vhc po [[[UIWindow keyWindow] rootViewController] _printHierarchy]
@capttaco
capttaco / Fetchable.swift
Last active October 14, 2024 15:20
A utility protocol for custom NSManagedObjects that makes querying contexts simpler and more convenient. Requires Swift 2.
import CoreData
protocol Fetchable
{
typealias FetchableType: NSManagedObject
static func entityName() -> String
static func objectsInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> [FetchableType]
static func singleObjectInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> FetchableType?
static func objectCountInContext(context: NSManagedObjectContext, predicate: NSPredicate?) -> Int
@ccstone
ccstone / References For Learning & Using Applescript.md
Last active April 14, 2025 10:57
References For Learning & Using Applescript

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.

@Daemon-Devarshi
Daemon-Devarshi / PasteboardWatcher.swift
Last active October 6, 2023 14:15
A class which performs polling to determine the newly copied url of desired kind in an external app
//
// PasteboardWatcher.swift
// PasteboardWatcher
//
// Created by Devarshi Kulshreshtha on 6/19/15.PasteboardWatcher
// Copyright © 2015 Devarshi Kulshreshtha. All rights reserved.
//
import Cocoa
@raphaelhanneken
raphaelhanneken / DragAndDropImageView.swift
Last active February 15, 2023 13:29
NSImageView with drag and drop capabilities written in Swift.
//
// DragAndDropImageView.swift
// Iconizer
// https://github.com/raphaelhanneken/iconizer
//
import Cocoa
class DragDropImageView: NSImageView, NSDraggingSource {
/// Holds the last mouse down event, to track the drag distance.
@garkhipov
garkhipov / DateFormatters.swift
Created April 15, 2015 13:56
NSDateFormatter and NSDateComponentsFormatter example
import Foundation
let locale = NSLocale(localeIdentifier: "ru_RU")
let dateFormatter = NSDateFormatter()
dateFormatter.timeStyle = .ShortStyle
dateFormatter.dateStyle = .MediumStyle
dateFormatter.locale = locale
dateFormatter.doesRelativeDateFormatting = true
@bradtheappguy
bradtheappguy / create_ota_manifest.sh
Created April 4, 2015 07:50
Create an iOS Plist file using plistbuddy (OSX)
#!/bin/bash
#Creates an iOS OTA (Over the Air) Minifest File
URL="https://sywl.theappguy.guru/relayrunner/0.2.6/RunnerApp_0.2.6ent.ipa"
BUNDLE_ID="com.example.yourbundleid"
BUNDLE_VERSION="0.0.1"
TITLE="Your App Name"
FILE="yourmanifestfile.plist"