This file contains 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
import Foundation | |
import RxSwift | |
let networkQueue = DispatchQueue(label: "com.appName.networkQueue") | |
class Queue { | |
var name: String | |
public init (_ name: String) { | |
self.name = name |
This file contains 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
// I have some testing framework in the scope | |
// Questions below: | |
// 1. Should the description be like it is here, in first `it`, or with `only` word added: | |
// "should return Fizz when the number is divisible only by 3" | |
// That would imply that the number is divisible by 3 only, which is technically not true, as it is divisible | |
// by 1 as well, and some numbers, e.g. 6, 9, and so on, are divisible by themselves. | |
it('should return Fizz when the number is divisible by 3', () => { | |
// 2. Is that name enough, having `any` in it, to be complete in what numbers are producing `fizz`. | |
// There is also a matter of adding `only` (similar to case #1) having `anyNumberDivisibleOnlyBy3`. |
This file contains 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/env ruby | |
# Avoid all the script configuration and use this convenience script instead! | |
# | |
# 1) Put it into the same folder, | |
# 2) run the script: `ruby _execute.rb PATH/TO/THE_NOTE.txt` | |
################## | |
# Configure here # |
This file contains 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/ruby | |
# | |
# Inserts the file's name as the first header in the file, if it isn't already there. | |
# Assumes filename begins with a 14 digit zettelkasten ID. | |
# Original file saved as filename.bak. | |
# | |
# As always, caveat emptor. This code could harm your files, so try it on a backup. | |
# | |
Dir.glob('*.md') do |filename| | |
puts "working on: #{filename}" |
This file contains 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
class SourceListTableCellView: NSTableCellView { | |
override var draggingImageComponents: [NSDraggingImageComponent] { | |
let components = super.draggingImageComponents | |
guard | |
self.backgroundStyle == .emphasized, //emphasized = selected | |
let textField = self.textField, | |
let newStyle = textField.attributedStringValue.mutableCopy() as? NSMutableAttributedString, | |
let labelIndex = components.firstIndex(where: { $0.key == .label }) | |
else { | |
return components |
This file contains 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
// Created by Tony Mann on 3/22/15. | |
// Copyright (c) 2015 7Actions. All rights reserved. | |
// | |
// Adapted from http://ossh.com.au/design-and-technology/software-development/implementing-rich-text-with-images-on-os-x-and-ios/ | |
import UIKit | |
class ImageAttachment: NSTextAttachment { | |
var verticalOffset: CGFloat = 0.0 | |
This file contains 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
<$publications> | |
<$pubType=article?> | |
<$authors.name.@componentsJoinedByCommaAndAnd/>. <$fields.Title.stringByConvertingHyphensToDashes/>. <$fields.Journal.stringByRemovingTeX/>, <$fields.Volume.stringByConvertingHyphensToDashes/><$fields.Number.stringByConvertingHyphensToDashes.parenthesizedStringIfNotEmpty/><$fields.Pages?><$fields.Volume?>:<?$fields.Volume?><$fields.Number?>:<?$fields.Number?>page </$fields.Number?></$fields.Volume?><$fields.Pages.stringByConvertingHyphensToDashes/>, <?$fields.Pages?><$fields.Volume?>, <?$fields.Volume?><$fields.Number?>, </$fields.Number?></$fields.Pages?><$fields.Month.stringByConvertingHyphensToDashes.stringByAppendingSpaceIfNotEmpty/><$fields.Year/><$fields.Note.stringByPrependingFullStopAndSpace/>. | |
<?$pubType=book?> | |
<$authors?><$authors.name.@componentsJoinedByCommaAndAnd/><?$authors?><$editors.name.@componentsJoinedByCommaAndAnd/>, <$editors.@count=0?><?$editors.@count=1?>editor<?$editors.@count?>editors</$editors.@count?></$authors?>. <$fields.Title.stringByConvertin |
This file contains 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
import Cocoa | |
@objc | |
class SomeTextStorage: NSTextStorage { | |
private var storage: NSMutableAttributedString | |
override init() { | |
storage = NSMutableAttributedString(string: "", attributes: nil) | |
super.init() |
This file contains 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
;; Functions to work with frames | |
(provide 'ime-frame) | |
(defun screen-usable-height (&optional display) | |
"Return the usable height of the display. | |
Some window-systems have portions of the screen which Emacs | |
cannot address. This function should return the height of the | |
screen, minus anything which is not usable." |
This file contains 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/sh | |
set -e | |
# set your Frameworks path here | |
FRAMEWORKS_DIR="${SRCROOT}/../Frameworks/${PLATFORM_NAME}" | |
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" | |
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" | |
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" |