- bootstrap with typeahead
- jquery
This will use bootstrap with typeahead to create an autocomplete search.
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) | |
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)] |
# -*- 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 | |
# |
#!/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!" |
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: |
# -*- coding: utf-8 -*- | |
from vagrant import Vagrant | |
vm_name = 'vm_name_on_vagrantfile' | |
v = Vagrant() | |
hostname = v.hostname(vm_name=vm_name) |
from twisted.internet import reactor | |
from scrapy.crawler import Crawler | |
from scrapy.settings import Settings | |
from scrapy import signals | |
from testspiders.spiders.followall import FollowAllSpider | |
class MyPipeline(object): | |
def process_item(self, item, spider): |
Function | Shortcut |
---|---|
previous tab | ⌘ + left arrow |
next tab | ⌘ + right arrow |
go to tab | ⌘ + number |
go to window | ⌘ + Option + Number |
go to split pane by direction | ⌘ + Option + arrow |
go to split pane by order of use | ⌘ + ] , ⌘ + [ |
split window horizontally (same profile) | ⌘ + D |
split window vertically (same profile) | ⌘ + d |
# coding: utf-8 | |
import requests | |
from lxml import html | |
home = requests.get('http://www.submarino.com.br/') | |
home_tree = html.fromstring(home.text) | |
products_links_xpath = '//*[@id="tab"]/div/ul/li/div/a/@href' | |
products_links = home_tree.xpath(products_links_xpath) |