Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)
- Some utilities:
sudo apt-get install vim tmux git curl- Copy/paste from the command line:
| import csv | |
| from cStringIO import StringIO | |
| from scrapy.http import Request | |
| from scrapy.spider import BaseSpider | |
| from scrapy.selector import HtmlXPathSelector | |
| from scrapy_tests.items import CrunchfeedItem | |
| class Crunchfeed(BaseSpider): |
| {% load i18n future static fb_tags mezzanine_tags %} | |
| {% load sorl_thumbnail %} | |
| {% if query.pop %} | |
| <style> | |
| {% if query.pop == '4' %} | |
| #media-library-popup #header, #media-library-popup .object-tools {display: none;} | |
| #media-library-popup h1 {margin: -60px 0 15px 0;} | |
| {% else %} | |
| h1 {margin:-30px 0 15px 0;} |
| from cStringIO import StringIO | |
| @register.simple_tag | |
| def thumbnail(image_url, width, height, quality=95): | |
| """ | |
| Given the URL to an image, resizes the image using the given width and | |
| height on the first time it is requested, and returns the URL to the new | |
| resized image. if width or height are zero then original ratio is | |
| maintained. | |
| """ | |
| if not image_url: |
| # add this soewhere where it gets loaded very early, i.e. | |
| # your shop's models.py | |
| from django.contrib.auth import login | |
| from django.contrib.auth.signals import user_logged_in | |
| from django.dispatch import receiver | |
| from registration.signals import user_activated | |
| from shop.models.defaults.cart import Cart | |
| # This is an auto-generated Django model module. | |
| # You'll have to do the following manually to clean this up: | |
| # * Rearrange models' order | |
| # * Make sure each model has one field with primary_key=True | |
| # Feel free to rename the models, but don't rename db_table values or field names. | |
| # | |
| # Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]' | |
| # into your database. | |
| from django.db import models |
| #!/bin/bash | |
| mkdir prancing_heroku | |
| cd prancing_heroku | |
| django-admin.py startproject prancing_heroku | |
| echo "Django==1.3" > requirements.txt | |
| echo "psycopg2" >> requirements.txt | |
| echo "web: prancing_heroku/run_heroku_run.sh" > Procfile |
| namespace :heroku do | |
| desc "Generate the Heroku gems manifest from gem dependencies" | |
| task :gems do | |
| RAILS_ENV='production' | |
| Rake::Task[:environment].invoke | |
| list = Rails.configuration.gems.collect do |g| | |
| command, *options = g.send(:install_command) | |
| options.join(" ") + "\n" | |
| end | |
sudo apt-get install vim tmux git curlThis guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.
# Ensure system is in ship-shape.
aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev