Skip to content

Instantly share code, notes, and snippets.

View thedore17's full-sized avatar

Ted Henderson thedore17

View GitHub Profile
@thedore17
thedore17 / full_names.js
Created September 15, 2014 04:03
Takes people objects and returns full names
var Person = Class({
initialize: function(first, last) {
this.firstName = first;
this.lastName = last;
},
toString: function() {
return "My name is "+this.firstName+" "+this.lastName+" .";
}
});
@thedore17
thedore17 / trove_pick.py
Created September 9, 2015 14:27
Function to pick link for trove
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 / .swift
Created October 5, 2015 03:47
open govtrack to district
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 / CloakroomEncryptedChatVC.swift
Last active July 10, 2019 06:10
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.
//
// ChatPostDetailViewController.swift
// Cloakroom
//
// Created by Theodore Henderson on 3/31/16.
// Copyright © 2016 Capitol Bells, Inc. All rights reserved.
//
import SwiftyJSON
private extension Selector {