Short text about what this is all about.
AppDelegate
@ statusBar (awakeFromNib)
ViewController
// There's some function that takes an UnsafeBufferPointer | |
func f(ubp: UnsafeBufferPointer<UInt8>) | |
... | |
// I want to call it with NSData | |
let data: NSData(...) | |
f(UnsafeBufferPointer(start: UnsafePointer<UInt8>(data.bytes), count: data.length)) | |
// Would I need to NSData.withUnsafeBufferPointer() to exist? (Which of course it doesn't.) |
(import 'java.awt.Color) | |
(def *default-color-fraction* 0.2) | |
(def *default-blend-fraction* 0.5) | |
(defn- format-hex [c] | |
(str "#" (format "%02x%02x%02x" | |
(.getRed c) | |
(.getGreen c) |
(defn inside-byte [v] | |
(cond | |
(< v 0) 0 | |
(> v 255) 255 | |
:else v)) | |
(defn darker- [color fraction] | |
(let [fr (- 1.0 fraction) | |
red (inside-byte (-> (.getRed color) (* fr) Math/round)) | |
green (inside-byte (-> (.getGreen color) (* fr) Math/round)) |
(defun slime-compilation-finished (result) | |
(with-struct (slime-compilation-result. notes duration successp) result | |
(setf slime-last-compilation-result result) | |
(slime-show-note-counts notes duration successp) | |
(when slime-highlight-compiler-notes | |
;(slime-highlight-notes notes) | |
(growl (format "%s" (second (first notes))) | |
;(run-hook-with-args 'slime-compilation-finished-hook notes) | |
))) |
(defvar shortcut-list '(1 2 3 4 5)) | |
(defun unset-numeric-shortcuts (list) | |
(mapcar | |
'(lambda (n) | |
(global-unset-key (read-kbd-macro (format "C-%d" n)))) | |
list)) | |
(unset-numeric-shortcuts shortcut-list) |
(use 'clojure.walk) | |
(defmacro with-iota [& body] | |
"Provides the local 'iota' which starts at 0 and automatically self-increments" | |
(let [iota (gensym "whatever-")] | |
`(let [~iota ~(atom -1)] | |
~@(map #(postwalk-replace {'iota `(swap! ~iota inc)} %) body)))) | |
(with-iota | |
(let [a iota |
(defn range-without-zero [from to] | |
(filter #(not (= 0 %)) (range from to))) | |
(def my-range (range-without-zero -8 9)) | |
(def t-map-licoresse | |
(let [r (filter #(not (= 0 %)) (range -8 9))] | |
(concat (for [x r] [x -1]) | |
(for [x (reverse r)] | |
[x 1])))) |
// | |
// GistServiceSpec.swift | |
// XXXX | |
// | |
// Created by Chris Patrick Schreiner on 09/08/15. | |
// Copyright © 2015 Chris Patrick Schreiner. All rights reserved. | |
// | |
import Foundation | |
import Quick |
import Foundation | |
public typealias GistID = Int | |
public typealias Result = Int | |
public typealias ConfigDict = [String:String] | |
public class GistWriter { // when you create the instance it will be invalid | |
private var activeGist: GistID? |