This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Given a source image, create icons in all sizes needed for an iOS app icon. | |
| # See <https://developer.apple.com/library/ios/qa/qa1686/_index.html> for details. | |
| # | |
| # First (required) argument is path to source file. | |
| # | |
| # Second (optional) argument is the prefix to be used for the output files. | |
| # If not specified, defaults to "app_icon_". | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get the current git branch name | |
| git-branch-name() { | |
| git symbolic-ref --short HEAD | |
| } | |
| # Push new branch to origin and set up tracking | |
| git-push-new-branch() { | |
| git push -u origin $(git-branch-name) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public sealed class TrulyObservableCollection<T> : ObservableCollection<T> | |
| where T : INotifyPropertyChanged | |
| { | |
| public TrulyObservableCollection() | |
| { | |
| CollectionChanged += FullObservableCollectionCollectionChanged; | |
| } | |
| public TrulyObservableCollection(IEnumerable<T> pItems) : this() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private let onesSymbols = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"] | |
| private let tensSymbols = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"] | |
| private let hundredsSymbols = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"] | |
| /// Generate Roman numeral representation of a value. | |
| /// | |
| /// - parameter value: Numeric value to be represented. | |
| /// - returns: `String` (possibly empty) | |
| public func romanNumeralForValue(value: Int) -> String { | |
| if value <= 0 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generate a backtrace string for given exception. | |
| # Generated string is a series of lines, each beginning with a tab and "at ". | |
| def pretty_backtrace(exception) | |
| "\tat #{exception.backtrace.join("\n\tat ")}" | |
| end | |
| # Generate a string containing exception message followed by backtrace. | |
| def pretty_exception(exception) | |
| "#{exception.message}\n#{pretty_backtrace(exception)}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Return 'YYYY-MM-DD HH:MM:SS' string for current time, using local timezone. | |
| def timestamp() | |
| Time.now.strftime '%Y-%m-%d %H:%M:%S' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/swift | |
| import Cocoa | |
| let stdin = FileHandle.standardInput | |
| let stdout = FileHandle.standardOutput | |
| let stderr = FileHandle.standardError | |
| do { | |
| let inputData = stdin.readDataToEndOfFile() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // hexdump.swift | |
| // | |
| // This file contains library functions for generating hex dumps. | |
| // | |
| // The functions intended for client use are | |
| // | |
| // - `printHexDumpForBytes(_:)` | |
| // - `printHexDumpForStandardInput()` | |
| // - `hexDumpStringForBytes(_:)` | |
| // - `logHexDumpForBytes(_:)` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If in a Mercurial repository, output "<branch:bookmark/qtop+*->", where | |
| # "branch" is the current branch | |
| # ":bookmark" is the active bookmark, if any | |
| # "/qtop" is the current patch, if any | |
| # "+" if any files have been added | |
| # "-" if any files have been removed | |
| # "*" if any files have been modified | |
| # "?" if any files exist that have not been added | |
| # | |
| # If not in a Mercurial repository, produce no output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool mutexIsNew; | |
| using (System.Threading.Mutex m = | |
| new System.Threading.Mutex(true, uniqueName, out mutexIsNew)) | |
| { | |
| if (mutexIsNew) | |
| // This is the first instance. Run the application. | |
| else | |
| // There is already an instance running. Exit! | |
| } |