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
def sentenceAnagrams(sentence: Sentence): List[Sentence] = { | |
def sen_iter(occur: Occurrences): List[Sentence] = { | |
if (occur == List()) | |
List(Nil) | |
else for { | |
word_occur <- combinations(occur).filter(_ != List()) | |
word <- dictionaryByOccurrences(word_occur) | |
rest <- sen_iter(subtract(occur, word_occur)) | |
} yield word :: rest | |
} |
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 urlparse | |
from scrapy.contrib.spiders import CrawlSpider, Rule | |
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor | |
from scrapy.selector import HtmlXPathSelector | |
from isbullshit.items import IsBullshitItem | |
class IsBullshitSpider(CrawlSpider): | |
""" General configuration of the Crawl Spider """ |
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
from scrapy.contrib.spiders import CrawlSpider, Rule | |
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor | |
from scrapy.selector import HtmlXPathSelector | |
from dmovie.items import MovieItem | |
import re | |
class MovieSpider(CrawlSpider): | |
name = 'douban_movie' | |
allowed_domains = ["http://movie.example.com/"] | |
start_urls = ['http://movie.douban.com/'] |
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
$('body').append('<div id="tylerdurden"></div>'); | |
$('#tylerdurden').click(function(e){ | |
DBR.act($(this).attr('action')); | |
}); |
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/env python | |
import requests | |
from lxml import html | |
from datetime import datetime, timedelta | |
# get news in last X days | |
DAY = 3 | |
# url of the news page |
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
from fabric.api import local, run | |
from pyquery import PyQuery as pq | |
BASE_URL = "http://hackermonthly.com/" | |
HACKER_URL = "http://hackermonthly.com/issues.html" | |
d = pq(url=HACKER_URL) | |
issue_list = d("#issues li a") | |
def get_issue(inex, node): | |
d = pq(node) |
NewerOlder