Usage:
SpoonDaemon.new('start', 'path/to/my/script.rb', 'tmp/pids')
def title(title = t('.title')) | |
@page_title = title | |
end |
# To stop apache2 for this session only: | |
sudo /etc/init.d/apache2 stop | |
# To remove apache2 permanently from startup scripts: | |
sudo update-rc.d apache2 remove | |
# To reinstate apache2 in the startup scripts: | |
sudo update-rc.d apache2 defaults | |
# Or edit /etc/default/apache2 as root and set NO_BOOT to 1. |
class AvatarUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
storage :file | |
def store_dir | |
"assets/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | |
end | |
version :thumb do | |
process :resize_to_fill => [60, 60] |
before_validation :clear_empty_attributes | |
protected | |
def clear_empty_attributes | |
attributes.each do |key,value| | |
self[key] = nil if value.is_a?(String) && value.blank? | |
end | |
end |
(function($) { | |
$.fn.myPlugin = function(settings) { | |
var config = {'foo': 'bar'}; | |
if (settings) $.extend(config, settings); | |
this.each(function() { | |
// element-specific code here | |
}); |
#!/bin/bash | |
# | |
# Download and install libevent and memcached from source on Debian Etch or | |
# Debian Lenny. | |
# | |
# Assumptions | |
# - libevent and memcached have not been installed from apt repositories | |
# - memcached is not already running | |
# - it is ok to clobber scripts at | |
# /etc/memcached.conf |
require 'action_controller/test_process' | |
class Factory | |
module FixtureFileUpload | |
def fixture_file_upload(attr_name, path, mime_type=nil, binary=false) | |
uploaded_file = ActionController::TestUploadedFile.new( | |
Test::Unit::TestCase.respond_to?(:fixture_path) ? Test::Unit::TestCase.fixture_path + path : path, | |
mime_type, | |
binary | |
) | |
add_attribute attr_name, uploaded_file |
source :rubygems | |
gem 'redis' | |
gem 'mongoid' | |
gem 'celluloid' |
module Actors | |
class Manager | |
include Celluloid | |
include Celluloid::Logger | |
def initialize | |
@brokers = CONF.brokers.voip | |
@brokers.each do |broker, conf| | |
StompListener.supervise_as("#{broker}_listener".to_sym, | |
current_actor, |
Usage:
SpoonDaemon.new('start', 'path/to/my/script.rb', 'tmp/pids')