Installation commands:
$ wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
$ tar xvfz redis-2.2.2.tar.gz
$ cd redis-2.2.2/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ sudo useradd redis| # Script to generate a CSV of all your Twitter followers screen_name, name, url, and description (bio) | |
| # Runs fine on OS X: put into a file, and then from a Terminal: ruby whatever.rb to run. | |
| require 'json' | |
| puts "Enter your Twitter username:" | |
| username = gets.chomp | |
| puts "Enter your Twitter password:" | |
| password = gets.chomp | |
| require 'rubygems' | |
| require 'mime/types' | |
| require 'xmlrpc/client.rb' | |
| require 'uri' | |
| # WordPressr - WordPress posting client library for Ruby | |
| # By Peter Cooper | |
| # | |
| # LICENSE: | |
| # MIT, BSD, whatever. Use the code at your own risk, I'm not |
| # Bits and pieces from my large, multi-file Sinatra app.. just to show structure | |
| # ----- | |
| # Main base Sinatra app setup | |
| module Cio | |
| class App < Sinatra::Base | |
| configure do | |
| # Set global vars | |
| set :root, APP_ROOT |
| require "application_responder" | |
| class ApplicationController < ActionController::Base | |
| # ... | |
| def self.acts_as_magical | |
| around_filter :magic_new, :only => :new | |
| around_filter :magic_show, :only => :show | |
| around_filter :magic_edit, :only => :edit |
| # Module with mixins for common queries across descendants: | |
| module Descendant | |
| # I guess I could use ActiveSupport::Concern here... | |
| def self.included(receiver) | |
| receiver.extend ClassMethods | |
| receiver.send :include, InstanceMethods | |
| end | |
| module ClassMethods | |
| def self.included(receiver) |
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| # irb3 - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple | |
| # versions of Ruby at once (using RVM) | |
| # | |
| # By Peter Cooper, BSD licensed | |
| # | |
| # Main dependency is term-ansicolor for each impl: | |
| # rvm exec gem install term-ansicolor |
Installation commands:
$ wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
$ tar xvfz redis-2.2.2.tar.gz
$ cd redis-2.2.2/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ sudo useradd redis| # app/models/wizard.rb | |
| class Wizard | |
| # shared instance methods go here | |
| def self.all_visible_subwizards | |
| descendants.entries.select{|d| d.visible?}.sort | |
| end | |
| end | |
| # lib/wizard_fields.rb |
| require "rubygems" | |
| require "bundler/setup" | |
| require "sinatra" | |
| require "base64" | |
| get "/" do | |
| Base64.encode64(File.binread("image")) | |
| end |