Skip to content

Instantly share code, notes, and snippets.

View calas's full-sized avatar

Jorge Calás calas

  • RubiconMD Healthcare Inc.
  • Santiago de Compostela, A Coruña, Spain
View GitHub Profile
namespace :monit do
namespace :debian do
desc <<-DESC
Install monit.
"Source":#{link_to_source(__FILE__)}
DESC
task_arg(:monit_port, "Monit port", :default => 2812)
# parent model
def readonly?
state == "closed" && !changed.include?('state')
end
# child model
def readonly?
# ...
parent.state == "closed"
# ...
#!/usr/bin/env ruby
require 'rubygems'
require 'logger'
class UrlParser
attr_reader :url, :file, :line, :column
def initialize(url)
@url = url
parse_url
end
if defined?(Footnotes)
Footnotes::Filter.prefix = 'emacs://open?url=file://%s&line=%d&column=%d'
end
Go to: about:config in firefox
right click and create a new boolean property:
network.protocol-handler.external.emacs -> true
#!/usr/bin/env ruby
require 'rubygems'
require 'logger'
class UrlParser
attr_reader :url, :file, :line, :column
def initialize(url)
@url = url
parse_url
end
var actualizarConductores = function(element) {
$$('select.conductor').each(function(s) {
actualizarSelect(s, element.value, 'Seleccione un conductor', conductores);
});
};
var filtrarConductores = Behavior.create({
initialize : function() {actualizarConductores(this.element);},
onchange : function() {actualizarConductores(this.element);}
});
FLASH_NOTICE_KEYS = [:error, :notice, :warning, :message, :success]
def flash_messages
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
formatted_messages = messages.map do |type|
content_tag :div, :class => "#{type}Explanation" do
flash_message_for(flash[type])
end
end
formatted_messages.join
FLASH_NOTICE_KEYS = [:error, :notice, :success]
def flash_messages
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
formatted_messages = messages.map do |type|
content_tag :div, :class => "flash #{type}" do
flash_message_for(flash[type])
end
end
formatted_messages.join
(defun haml-convert-rhtml-file (rhtmlFile hamlFile)
"Convierte un fichero rhtml en un haml y abre un nuevo buffer"
(interactive "fSelect rhtml file: \nFSelect output (haml) file: ")
(let ((comando (concat "/usr/local/bin/html2haml -r "
rhtmlFile
" "
hamlFile)))
(shell-command comando)
(find-file hamlFile)))