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 AppKit | |
import ScriptingBridge | |
@objc public protocol SBObjectProtocol: NSObjectProtocol { | |
func get() -> Any! | |
} | |
@objc public protocol SBApplicationProtocol: SBObjectProtocol { | |
func activate() | |
var delegate: SBApplicationDelegate! { get set } |
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
// XCode 8.3 | |
// Swift 3.1 | |
import Cocoa | |
class SomeViewController: NSViewController { | |
@IBOutlet weak var artwork: NSImageView! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
" Rename buffer (:Rename) {{{ | |
function! s:RenameBuffer(name) | |
silent! execute 'saveas! ' . a:name | |
let l:old_buffer = bufnr("#") | |
let l:old_filename = expand("#:t") | |
let l:new_buffer = bufnr("%") | |
let l:new_filename = expand("%:t") | |
silent! execute '!rm ' . shellescape(expand("#"), 1) | |
silent! execute 'bd' l:old_buffer | |
echom 'Renamed `' . l:old_filename . '` to `' . l:new_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
/** | |
* Convert a number or array of integers to a string of padded hex octets. | |
*/ | |
function asHex(value: Array<number> | Uint8Array): string { | |
return Array.from(value).map(i => ('00' + i.toString(16)).slice(-2)).join(''); | |
} | |
/** | |
* Attempt to securely generate random bytes/ | |
*/ |
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
/** | |
* @flow | |
*/ | |
import request from 'lib/request'; | |
type F<T> = (response: T) => bool; | |
const BACKOFF_MAX = 60; // seconds | |
const BACKOFF_ATTEMPTS = 60; |
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
// | |
// NaturalMotion.swift | |
// | |
// Created by Maciej Swic on 2014-06-06. | |
// Released under the MIT license. | |
// | |
import UIKit | |
extension UIView { |
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
ּ_בּ | |
בּ_בּ | |
טּ_טּ | |
כּ‗כּ | |
לּ_לּ | |
מּ_מּ | |
סּ_סּ | |
תּ_תּ | |
٩(×̯×)۶ | |
٩(̾●̮̮̃̾•̃̾)۶ |
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 Foo | |
autoload :Bar, 'foo/bar' | |
autoload :Baz, 'foo/baz' | |
end |
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
@instance_store = {} | |
class App.Model extends Backbone.Model | |
cache_enabled: false | |
cache_key: "id" | |
constructor: (attr) -> | |
@on "destroy", @_removeFromStore |
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
# ### Point.angleForCircle( origin, point ) -> Number | |
# | |
# * **origin** ( `Point` ): Origin of circle. | |
# * **point** ( `Point` ): Point to find angle of. | |
# | |
# Get the angle (in degrees) of a point for a given origin of a circle. | |
Point.angleForCircle = (origin, point) -> | |
x = origin.x - point.x | |
y = origin.y - point.y | |
r = Math.sqrt Math.pow(x, 2) + Math.pow(y, 2) |