- bootstrap with typeahead
- jquery
This will use bootstrap with typeahead to create an autocomplete search.
| # -*- coding: utf-8 -*- | |
| from vagrant import Vagrant | |
| vm_name = 'vm_name_on_vagrantfile' | |
| v = Vagrant() | |
| hostname = v.hostname(vm_name=vm_name) |
| Vagrant.configure("2") do |config| | |
| config.vm.box = "MY_BOX_NAME" | |
| config.vm.provider :aws do |aws, override| | |
| aws.access_key_id = "MY_ACCESS_KEY_ID" | |
| aws.secret_access_key = "MY_SECRET_ACCESS_KEY" | |
| aws.keypair_name = "MY_KEYPAIR_NAME" | |
| aws.security_groups = "MY_VAGRANT_SECURITY_GROUP" | |
| # take a look here for AMIs/regions info: |
| #!/usr/bin/env python | |
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import pika | |
| import sys | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| host='localhost')) | |
| channel = connection.channel() | |
| message = ' '.join(sys.argv[1:]) or "Hello World!" |
| # -*- coding:utf-8 -*- | |
| import pika | |
| from pika import exceptions | |
| from pika.adapters import twisted_connection | |
| from twisted.internet import defer, reactor, protocol, task | |
| # First of all, what is a Twisted deferred? | |
| # reference http://migre.me/eBL9F | |
| # |
| class CustomSpider(BaseSpider): | |
| def __init__(self, start_url=None, **kwargs): | |
| super(BaseSpider, self).__init__(*args, **kwargs) | |
| if start_url: | |
| self.start_url = start_url | |
| def start_requests(self): | |
| return [Request(self.start_url)] |
| from scrapy.utils.project import get_project_settings | |
| def stop_reactor(): | |
| reactor.stop() #Stops reactor to prevent script from hanging | |
| if __name__ == '__main__': | |
| #Handles engine_stopped to stop twisted reactor | |
| dispatcher.connect(stop_reactor, signal=signals.engine_stopped) | |