Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'redis'
r = Redis.new
(0..100000).each{|i|
["name","surname","age","sex","password"].each{|field|
if false
r.set("obj#{i}#{field}","foo")
else
r.hset("obj#{i}",field,"foo")
#content
.left.column
%h2 Welcome to our site!
.right.column
#users
{{#users}}
%p {{user}}
{{/users}}
# app/controllers/posts_controller.rb
class PostsController < ApplicationController
def index
@posts.all_cached # Retrive only at once by every 5 minutes
expires_in 5.minutes, :private => false, :public => true
end
end
# app/models/post.rb
Class Post
@activelabs
activelabs / Jabber-SH
Created January 19, 2010 12:39 — forked from pcreux/Jabber-SH
#!/usr/bin/env ruby
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] => harmonyapp.com
def self.[](key)
unless @config
raw_config = File.read(RAILS_ROOT + "/config/harmony.yml")
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
end
@config[key]
end