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
(def (do-post) | |
(http-post "http://localhost:9515/session" | |
headers: '(("Content-Type" . "application/json; charset=utf-8") | |
("Accept-Encoding" . "identity") | |
("Accept" . "*/*")) | |
data: (json-object->string capabilities))) | |
(def (get-session) | |
(let (req (do-post)) | |
(for-each (lambda (h) (printf "~s~%" h)) (request-headers req)) |
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/env bash | |
gambit_dir=$(brew --prefix gambit-scheme) | |
openssl_dir=$(brew --prefix openssl) | |
ssl="${openssl_dir}/lib/libssl.a" | |
crypto="${openssl_dir}/lib/libcrypto.a" | |
gambita="${gambit_dir}/current/lib/libgambit.a" | |
gsc="/usr/local/opt/gambit-scheme/current/bin/gsc" | |
#include="-I${gambit_dir}/current/include" | |
#opts="-Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-math-errno -fomit-frame-pointer -fPIC -fno-common -D___SINGLE_HOST" |
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
(define (http:resolve url) | |
(define resolved-url | |
(make-parameter (uri-reference url))) | |
(define (update-resolved-url r) | |
(resolved-url (request-uri r)) | |
(default-prepare-request r)) | |
(parameterize ((prepare-request update-resolved-url)) |
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
(define (http:resolve url) | |
(max-redirect-depth 0) | |
(let* ((uri (uri-reference url)) | |
(request (make-request uri: uri headers: basic-headers))) | |
(display "calling\n") | |
(handle-exceptions exn | |
(lambda (exn) |
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
let blurb = { "text": "", "date": "", "link": "", "title": "" } | |
const isValidDate = (d) => d instanceof Date && !isNaN(d) | |
draft.content.split("\n").forEach((text) => { | |
const line = text.trim() | |
if (line.startsWith("text:")) { | |
blurb.text = line.replace("text:", "").trim() | |
if (blurb.text.trim() == "") { |
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
override func splitView(_ splitView: NSSplitView, additionalEffectiveRectOfDividerAt dividerIndex: Int) -> NSRect { | |
super.splitView(splitView, additionalEffectiveRectOfDividerAt: dividerIndex) | |
assert(splitViewItems.count == 2) | |
if splitViewItems.count != 2 { return .zero } | |
if !splitViewItems[1].isCollapsed { return .zero } | |
return NSMakeRect(splitView.bounds.maxX-6, 0, 6, splitView.bounds.height) | |
} |
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 func handleMessage(_ message: IRC.Message) { | |
if let storage = chatTextView.textStorage, | |
let render = format(message) { | |
storage.append(render) | |
//storage.insert(render, at: storage.length) | |
} | |
chatTextView.scrollToEndOfDocument(self) | |
} | |
private let chatFont = NSFont.systemFont(ofSize: 14) |
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
import Cocoa | |
class ActivityManager { | |
var activityUpdate: NSBackgroundActivityScheduler? | |
var serialize = DispatchQueue(label: "sync", qos: .background) | |
func backgroundActivitiesSetup() { | |
print("Setting up activity runner.") | |
activityUpdate = NSBackgroundActivityScheduler(identifier: "…") |
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
var activityUpdate: NSBackgroundActivityScheduler? | |
func backgroundActivitiesSetup() { | |
activityUpdate = NSBackgroundActivityScheduler(identifier: "…") | |
activityUpdate?.interval = 1 * 60 // every 1 minute | |
activityUpdate?.repeats = true | |
activityUpdate?.schedule { completion in | |
updateNewItems(completion) | |
} | |
} |
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
var activity: NSBackgroundActivityScheduler? | |
func runActivity() { | |
activity = NSBackgroundActivityScheduler(identifier: "lkasjdlaksjdaslkjd") | |
activity?.repeats = true | |
activity?.interval = 15 | |
activity?.schedule { completion in | |
// This doesn't make sense: defer should be periodically checked in | |
// the middle of a long job. |