Skip to content

Instantly share code, notes, and snippets.

Avatar

Ted Henderson thedore17

View GitHub Profile
@thedore17
thedore17 / CloakroomEncryptedChatVC.swift
Last active Jul 10, 2019
This is the source code for the Cloakroom iOS app's private chat feature. It's end-to-end cryptography is powered by Virgil Security's open source cryptographic library. All encryption and decryption is handled here on the front-end. The users' private encryption keys never leave the local device.
View CloakroomEncryptedChatVC.swift
//
// ChatPostDetailViewController.swift
// Cloakroom
//
// Created by Theodore Henderson on 3/31/16.
// Copyright © 2016 Capitol Bells, Inc. All rights reserved.
//
import SwiftyJSON
private extension Selector {
@thedore17
thedore17 / .swift
Created Oct 5, 2015
open govtrack to district
View .swift
func setWebViewMapWith(state: String, district: String) {
if (district != "0") {
districtUrl = "https://www.govtrack.us/congress/members/embed/mapframe?state=\(state)&district=\(district)"
}else {
districtUrl = "https://www.govtrack.us/congress/members/embed/mapframe?state=\(state)"
}
setWebViewUrl(districtUrl)
}
func setWebViewUrl(url: String) {
@thedore17
thedore17 / trove_pick.py
Created Sep 9, 2015
Function to pick link for trove
View trove_pick.py
def trove_link(link_url, comment=None):
logging.debug('Sending link to Trove')
#Setup the https headers and payload data
headers = {'Trove-Authorization': TROVE_TOKEN}
payload = {"url": link_url, "key": TROVE_API_KEY, "display_text": comment}
response = requests.post(TROVE_PICK_URL, params=payload, headers=headers)
#Just printing the return for debugging purposes here.
logging.debug('Trove HTTP Response: '+str(response.status_code)+', Message: '+response.reason)
@thedore17
thedore17 / full_names.js
Created Sep 15, 2014
Takes people objects and returns full names
View full_names.js
var Person = Class({
initialize: function(first, last) {
this.firstName = first;
this.lastName = last;
},
toString: function() {
return "My name is "+this.firstName+" "+this.lastName+" .";
}
});