Skip to content

Instantly share code, notes, and snippets.

View digitalpardoe's full-sized avatar
💭
¯\_(ツ)_/¯

Alex Pardoe digitalpardoe

💭
¯\_(ツ)_/¯
View GitHub Profile
@digitalpardoe
digitalpardoe / application_helper.rb
Created July 16, 2011 17:12
Textilize Alternative
def custom_text(text)
if text.blank?
""
else
text = RedCloth.new(text).to_html
if text[0..2] == "<p>" then text = text[3..-1] end
if text[-4..-1] == "</p>" then text = text[0..-5] end
text = text.gsub("<p>", "")
text = text.gsub("</p>", "")
return text
@digitalpardoe
digitalpardoe / contact.html.erb
Created July 16, 2011 17:02
An Email Form with Ruby on Rails
<% form_for :email, :url => { :controller => 'contact', :action => 'send_mail' } do |f| %>
<%= f.label :name %><br />
<%= f.text_field :name, :size => 60 %><br />
<%= f.label :address %><br />
<%= f.text_field :address, :size => 60 %><br />
<%= f.label :subject %><br />
<%= f.text_field :subject, :size => 60 %><br />
<%= f.label :body %><br />
<%= f.text_area :body, :rols => 10, :cols => 60 %><br />
<%= submit_tag "Send Email "%>