This file contains hidden or 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
| require 'fech' | |
| require 'spreadsheet' | |
| module Fech | |
| class Filing | |
| # Create an XLS spreadsheet from a filing. | |
| def as_xls(filename=nil) | |
| spreadsheet = Spreadsheet::Workbook.new | |
| bold = Spreadsheet::Format.new :weight => :bold |
This file contains hidden or 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
| require 'fech' | |
| require 'google_spreadsheet' | |
| module Fech | |
| class Filing | |
| # Create a Google Spreadsheet from a filing. | |
| # Note that for large filings, this will fail because of the limit | |
| # Google Spreadsheets places on the number of cells. | |
| def upload_to_google_spreadsheet(email, password, title=nil) |
This file contains hidden or 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
| aaronbycoffe@us150633:~$ curl -I newtgingrich.com | |
| HTTP/1.1 200 OK | |
| Content-Length: 1037 | |
| Content-Type: text/html | |
| Content-Location: http://newtgingrich.com/redirect.htm | |
| Last-Modified: Wed, 21 Dec 2011 19:35:56 GMT | |
| Accept-Ranges: bytes | |
| ETag: W/"c819afc217c0cc1:31c" | |
| Server: Microsoft-IIS/6.0 | |
| X-Powered-By: ASP.NET |
This file contains hidden or 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
| aaronbycoffe@us150633:~$ curl -I newtgingrich.com | |
| HTTP/1.1 200 OK | |
| Content-Length: 873 | |
| Content-Type: text/html | |
| Content-Location: http://newtgingrich.com/redirect.htm | |
| Last-Modified: Wed, 21 Dec 2011 02:02:42 GMT | |
| Accept-Ranges: bytes | |
| ETag: "c6f3b09f84bfcc1:314" | |
| Server: Microsoft-IIS/6.0 | |
| X-Powered-By: ASP.NET |
This file contains hidden or 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
| loadTemplate = (filename) -> | |
| jQuery.ajax({ | |
| url: filename, | |
| async: false, | |
| }).responseText |
This file contains hidden or 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
| // Adapted from http://www.swharden.com/blog/2008-11-17-linear-data-smoothing-in-python/ | |
| var smooth = function (list, degree) { | |
| var win = degree*2-1; | |
| weight = _.range(0, win).map(function (x) { return 1.0; }); | |
| weightGauss = []; | |
| for (i in _.range(0, win)) { | |
| i = i-degree+1; | |
| frac = i/win; | |
| gauss = 1 / Math.exp((4*(frac))*(4*(frac))); | |
| weightGauss.push(gauss); |
This file contains hidden or 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
| class window.GoogleChart | |
| constructor: -> | |
| @width = 0 | |
| @height = 0 | |
| @encoded = [] | |
| @data = [] | |
| simpleEncoding: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | |
| extendedMap: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.', |
This file contains hidden or 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
| """ | |
| First pass at scraping the FAPIIS site, just to see if it's possible. | |
| This seems to work, but it's impossible to know whether the data it's | |
| returning will be accurate since FAPIIS doesn't currently contain any | |
| data. | |
| This method requires knowing the company's DUNS number, though it's | |
| likely possible to back this up a step to allow for searching by name. | |
| """ | |
| import urllib |
This file contains hidden or 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/python | |
| ''' | |
| Python-based gift exchange randomizer. | |
| Step through a list of people and, for each member of that list, | |
| select someone else to be a recipient of their gift. That recipient: | |
| A) Must not be themselves (no self-gifting) | |
| B) Must not already have been assigned as a recipient | |
This file contains hidden or 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
| class FixedWidthParser(object): | |
| """A parser for fixed-width data files. Pass in a data file and | |
| a list of field names and lengths, and get back a dictionary | |
| for each row. | |
| Useful for converting a fixed-width file to a CSV. | |
| See tests.py for a usage example. | |
| """ |