This file contains 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.xlib.pydispatch import dispatcher | |
from scrapy import signals | |
from scrapy.exceptions import DropItem | |
from scrapy.utils.serialize import ScrapyJSONEncoder | |
from carrot.connection import BrokerConnection | |
from carrot.messaging import Publisher | |
from twisted.internet.threads import deferToThread |
This file contains 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 BeautifulSoup import BeautifulSoup | |
import requests | |
import os | |
album_url = "http://imgur.com/a/TYfWa/all/hot/day/page/%d?scrolled" | |
pages = 3 | |
directory = "heroes" | |
posts_list = [] |
This file contains 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 bootstrap_paginate(pages, options={}) | |
options.reverse_merge!( | |
:class => 'pagination', | |
:renderer => BootstrapLinkRenderer, | |
:previous_label => '←'.html_safe, | |
:next_label => '→'.html_safe | |
) | |
will_paginate(pages, options) | |
end |
This file contains 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
- flash.each do |type, message| | |
.alert.alert-block{:class => "alert-#{bootstrap_alert_type(type)}" } | |
%h4.alert-heading #{ bootstrap_alert_type(type).titleize }! | |
= message |
This file contains 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
$.extend($.validator.messages, { | |
required: "can't be blank", | |
remote: 'needs to get fixed', | |
email: 'is an invalid email address', | |
url: 'is not a valid URL', | |
date: 'is not a valid date', | |
dateISO: 'is not a valid date (ISO)', | |
number: 'is not a valid number', | |
digits: 'needs to be digits', | |
creditcard: 'is not a valid credit card number', |
This file contains 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 CarmenCountryInput < SimpleForm::Inputs::PriorityInput | |
def input | |
@builder.send(:"country_select", attribute_name, input_options, input_html_options) | |
end | |
end |
This file contains 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
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript | |
powered JS and SASS powered CSS with YUI compression all via the magic of rack. | |
This stuff will be native in Rails 3.1 and the layout of the files on the | |
filesystem will be different but this guide will get you working with it | |
while we wait for all that to finalize. | |
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist. | |
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention |
This file contains 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
<div id="fb-root"></div> | |
<script> | |
var fbAppId = '< APP ID >'; | |
(function(){ | |
var fbInitFuncs = []; | |
var fbInitialized = false; | |
window.fbAsyncInit = function() { |
This file contains 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 django.conf.urls import patterns, url | |
from django.contrib.contenttypes.models import ContentType | |
from appname1.views import PostListView, PostDetailView, \ | |
PostCreateView, PostDeleteView, PostUpdateView | |
from appname2.views import CommentListView,\ | |
CommentDetailView, CommentCreateView, CommentDeleteView, \ | |
CommentUpdateView | |
from models import Post |
This file contains 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 sys | |
from collections import defaultdict | |
import requests | |
file_name = sys.argv[1] | |
results = defaultdict(list) | |
with open(file_name) as f: |
OlderNewer