View gist:bd59898bdd020494fdd7
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
extension Array { | |
func toDict<K,V>(map: (Element) -> (K, V)?) -> [K: V] { | |
var dict = [K: V]() | |
for element in self { | |
if let (key, value) = map(element) { | |
dict[key] = value | |
} | |
} | |
return dict | |
} |
View RawRepresentable-Equatable.swift
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
func ==<U: Equatable, T: protocol<RawRepresentable, Equatable> where T.RawValue == U>(lhs: U, rhs: T) -> Bool { | |
return lhs == rhs.rawValue | |
} | |
func !=<U: Equatable, T: protocol<RawRepresentable, Equatable> where T.RawValue == U>(lhs: U, rhs: T) -> Bool { | |
return lhs != rhs.rawValue | |
} |
View rainclok.py
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
#!/usr/bin/env python3 | |
# encoding=utf8 | |
from PyQt5.QtCore import * | |
from PyQt5.QtWidgets import * | |
from PyQt5.QtGui import * | |
from PyQt5.QtSvg import * | |
from datetime import datetime | |
import requests | |
import lxml.html |