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
""" | |
Import and process yahoo data | |
""" | |
from cStringIO import StringIO | |
import requests | |
from datetime import datetime | |
from pandas import DataFrame | |
from pandas.io.parsers import read_table |
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
import re | |
from cPickle import dump | |
from requests import get | |
DEFAULT_TICKERS = ['goog', 'aapl'] | |
URL = 'http://www.sec.gov/cgi-bin/browse-edgar?CIK={}&Find=Search&owner=exclude&action=getcompany' | |
CIK_RE = re.compile(r'.*CIK=(\d{10}).*') | |
cik_dict = {} | |
for ticker in DEFAULT_TICKERS: |
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 PageObjectDelegator | |
include Capybara::DSL | |
include Rails.application.routes.url_helpers | |
def initialize(*args) | |
# Create a `path` => `page object model` hash | |
@pages = {} | |
@pages[foo_bar_path] = FooBarPage.new("Foo Bar") | |
@pages[baz_path] = BazPage.new("Baz") | |
end |
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
if request.is_ajax(): | |
if form.is_valid(): | |
# I doubt we would ever save on an ajax POST. | |
goal = form.save() | |
# Serialize the goal in json format and send the | |
# newly created object back in the reponse | |
# have to put it in a list even if it's just one instance. | |
data = serializers.serialize('json', [goal,]) | |
else: |
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
$(document).on("submit", "#test_form", function(e) { | |
e.preventDefault(); | |
var self = $(this), | |
url = self.attr("action"), | |
// Note: CSRF token already added to HTTP Headers | |
ajax_req = $.ajax({ | |
url: url, | |
type: "POST", | |
data: { | |
// Send the form data with POST request |
NewerOlder