download and un-tar
create db directory
mkdir -p /data/db
export mongo bin directory
export MONGO_BIN="/Users/lawless/Downloads/mongodb-osx-x86_64-1.0.1/bin"
export PATH="$PATH:$MONGO_BIN"
<!-- PHP --> | |
<?php echo date('Y'); ?> |
""" | |
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation. | |
""" | |
import os | |
import socket | |
# Set DEBUG = True if on the production server | |
if socket.gethostname() == 'your.domain.com': | |
DEBUG = False |
download and un-tar
create db directory
mkdir -p /data/db
export mongo bin directory
export MONGO_BIN="/Users/lawless/Downloads/mongodb-osx-x86_64-1.0.1/bin"
export PATH="$PATH:$MONGO_BIN"
require 'test_helper' | |
class StaticPagesControllerTest < ActionController::TestCase | |
%w( faq about privacy terms_and_conditions ).each do |page| | |
should_route :get, "/#{page}", :controller => :static_pages, :action => page.to_sym | |
context "Accessing #{page} page" do | |
setup { get page } | |
should_respond_with :success |
ActionController::Routing::Routes.draw do |map| | |
map.with_options :controller => "static_pages" do |pages| | |
%w( faq about privacy terms_and_conditions ).each do |page| | |
pages.send(page, page, :action => page) | |
end | |
end | |
# ... | |
end |
# This is an implementation using python-oembed with api.embed.ly | |
# python-oembed http://code.google.com/p/python-oembed/ | |
import oembed | |
# Embed.ly Multi Provider API Endpoint | |
OEMBED_ENDPOINT = 'http://api.embed.ly/oembed/api/v1' | |
# URL Schemes Supported --- complete list maintained | |
# http://api.embed.ly/static/data/embedly_regex.json |
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb | |
# and made a lot more robust by me | |
# this implementation uses erb by default. if you want to use any other template mechanism | |
# then replace `erb` on line 13 and line 17 with `haml` or whatever | |
require 'sinatra/base' | |
module Sinatra | |
module Partials | |
def partial(template, *args) |
<div class="tab" id="main"> | |
<a href="http://yadda.ya/foo#main">Main</a> | |
... | |
</div> | |
<div class="tab" id="other"> | |
a href="http://yadda.ya/foo#other">Other</a> | |
... | |
</div> | |
.. etc .. |
require "rubygems" | |
require "highline" | |
require "mechanize" | |
hl = HighLine.new | |
email = hl.ask('E-mail: ') | |
password = hl.ask('Password: '){|q| q.echo = '*'} | |
list = [] |