Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Cobb cobbal

View GitHub Profile
@cobbal
cobbal / zoom.py
Created Dec 19, 2019
opens zoom to the next/current meeting on your calendar.If distributing publicly, please remove the client secret. fill in your calendar id before use.
View zoom.py
#!/usr/bin/env python3
# opens zoom to the next/current meeting on your calendar
# license: Apache 2.0
calendar="YOUR_USERNAME@instructure.com"
import datetime
import pickle
import os.path
try:
View override.swift
class A {
private var underlying: Int = 0
open var x: Int {
set {
print("A.set \(newValue)")
underlying = newValue
}
get { underlying }
}
}
@cobbal
cobbal / pre-commit
Last active Oct 2, 2019
swift lint before commit, put in ".git/hooks/pre-commit", then chmod +x it
View pre-commit
#!/bin/zsh
set -euo pipefail
if xcbeautify --version 2>/dev/null >/dev/null; then
./scripts/runSwiftLint.sh 2>&1 | xcbeautify
else
./scripts/runSwiftLint.sh 2>&1 | tail -n 1
fi
View keybase.md

Keybase proof

I hereby claim:

  • I am cobbal on github.
  • I am cobbal (https://keybase.io/cobbal) on keybase.
  • I have a public key ASAUd-s9K6D_sdwVhWPmyHg0V6o0jL5wmAC6sKyuyW-Elgo

To claim this, I am signing this object:

View keyDown.swift
func keyDown(theEvent: NSEvent) {
func intToString(x : Int) -> String {
return String(UnicodeScalar(x))
}
let hasCommand = (theEvent.modifierFlags & .CommandKeyMask).value != 0
switch theEvent.charactersIgnoringModifiers! {
case intToString(NSUpArrowFunctionKey) where hasCommand == true:
// Scroll to top
@cobbal
cobbal / monad.swift
Last active Apr 6, 2016
Monad protocol in swift
View monad.swift
protocol Monad {
typealias F
typealias U
class func bind<M : Monad where M.U == U>(Self, F -> M) -> M
class func `return`(F) -> Self
}
extension Array : Monad {
typealias F = T
@cobbal
cobbal / gist:4771297
Created Feb 12, 2013
Magic Trackpad HID Report Descriptor
View gist:4771297
0000000 05 01 09 02 a1 01 85 02 05 09 19 01 29 02 15 00
0000020 25 01 95 02 75 01 81 02 95 01 75 06 81 03 05 01
0000040 09 01 a1 00 15 81 25 7f 09 30 09 31 75 08 95 02
0000060 81 06 c0 05 06 09 20 85 47 15 00 25 64 75 08 95
0000100 01 b1 a2 06 02 ff 09 55 85 55 15 00 26 ff 00 75
0000120 08 95 40 b1 a2 85 13 15 00 25 01 75 01 95 01 06
0000140 01 ff 09 0a 81 02 06 01 ff 09 0c 81 22 75 01 95
0000160 06 81 01 c0 00
0000165
View gist:785536
$ cat realworlddata.txt | awk '{print $2}' | python2.7 -c 'import sys, collections; print collections.Counter(line.strip() for line in sys.stdin)'
Counter({'excellent': 66, 'good': 53, 'average': 6})
You can’t perform that action at this time.