Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh root@123.123.123.123
Add ssh fingerprint and enter password provided in email
module ActionView | |
class ErSass < ActionView::TemplateHandler | |
include ERB::Util | |
SASS_ENGINE_OPTS = { | |
:load_paths => Compass.configuration.sass_load_paths + ["#{Rails.root}/app/stylesheets"] | |
} | |
def self.call(template) | |
"ActionView::ErSass.new(self).render(template, local_assigns)" |
puts Readline::HISTORY.entries.split("exit").last[0..-2].join("\n") |
require 'rubygems' | |
require 'mechanize' | |
MAX_PAGES = 6 | |
def each_google_result_page(query, max_pages=MAX_PAGES) | |
i = 0 | |
a = Mechanize.new do |a| | |
a.get('http://google.com/') do |page| | |
search_result = page.form_with(:name => 'f') do |search| |
class Notification < ActiveRecord::Base | |
belongs_to :user | |
scope :for_user, lambda { |user| where(:user_id => user.id) } | |
scope :unexpired, where('expired_at is null') | |
delf self.expire! | |
with_scope do |
begin | |
require 'hirb' | |
rescue LoadError | |
# Missing goodies, bummer | |
end | |
if defined? Hirb | |
# Dirty hack to support in-session Hirb.disable/enable | |
Hirb::View.instance_eval do | |
def enable_output_method |
#! /usr/bin/env ruby | |
# usage: | |
# $ das_download.rb email password [download_directory] | |
require 'mechanize' | |
# gem 'mechanize-progressbar' | |
email = ARGV[0] or raise('Please provide the email address for your account') | |
password = ARGV[1] or raise('Please provide the password for your account') | |
path = ARGV[2] || './' |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed. | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
# | |
# Deployment structure | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |
require 'stringio' | |
require 'timeout' | |
class Object | |
def methods_returning(expected, *args, &blk) | |
old_stdout = $> | |
$> = StringIO.new | |
methods.select do |meth| | |
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |