Skip to content

Instantly share code, notes, and snippets.

@McNight
McNight / static.swift
Created Apr 19, 2020
Hashable's StaticString
View static.swift
import Foundation
extension StaticString: Equatable {
public static func == (lhs: StaticString, rhs: StaticString) -> Bool {
let lp = UnsafeRawPointer(lhs.utf8Start).assumingMemoryBound(to: Int8.self)
let rp = UnsafeRawPointer(rhs.utf8Start).assumingMemoryBound(to: Int8.self)
return strcmp(lp, rp) == 0
}
@McNight
McNight / .vimrc
Last active Mar 2, 2018
My .vimrc
View .vimrc
" Keys
let mapleader="," " leader is comma
set backspace=2 " make backspace work like most other programs
" Vim Plug
if has('nvim')
call plug#begin('~/.local/share/nvim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
@McNight
McNight / Contacts.swift
Last active Nov 27, 2015
Uppercase all contacts family names
View Contacts.swift
// A Twitter guy requested a way to update all his contacts family names to be uppercased
// So, I wanted to give a try to the all new iOS 9 Contacts framework
// I'm a Swift noob, I didn't even finish reading the Swift book (I'm at p. 302 :D)
import Contacts
let store = CNContactStore()
store.requestAccessForEntityType(.Contacts) { success, formerError in
View keybase.md

Keybase proof

I hereby claim:

  • I am McNight on github.
  • I am mcnight (https://keybase.io/mcnight) on keybase.
  • I have a public key whose fingerprint is 8106 3ED0 5D51 7480 DEEF 3C00 2C6B ED80 8831 7E3A

To claim this, I am signing this object:

You can’t perform that action at this time.