Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
| :: | |
| :: Reclaims Windows disk space in a "destructive" manner (can't uninstall service packs and updates afterwards, etc.). | |
| :: Use at your own risk. Useful for Windows installations in space-constrained environments, such as a small Boot Camp | |
| :: partition on a Mac. | |
| :: | |
| :: [IMPORTANT] It is strongly suggested to make a full-disk backup of your Windows partition before running this script, | |
| :: as you can't roll back service packs and updates afterwards. | |
| :: | |
| :: [IMPORTANT] Run this script as admin (required to run `Dism.exe` among other things). | |
| :: |
| # place the contents of this file in, e.g., spec/re_run_friendly_formatter.rb | |
| # | |
| # and in .rspec: | |
| # | |
| # --format ReRunFriendlyFormatter | |
| require "rspec/core/formatters/progress_formatter" | |
| class ReRunFriendlyFormatter < RSpec::Core::Formatters::ProgressFormatter | |
| RSpec::Core::Formatters.register self, :dump_summary |
| 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 |
Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
| # 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) | |
| # |
| #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) |
| #! /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] || './' |
| 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 |
| 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 |
| 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| |