Skip to content

Instantly share code, notes, and snippets.

<li class="job <%= compact.state %>">
<a href="<%= compact %>">
<div>
<strong>Description</strong>
<span><%= compact.description %></span>
</div>
<div>
<strong>Quantity</strong>
<span><%= compact.quantity %></span>
@testimonials = Testimonial.find(:all, :limit => 2, :order=> 'created_at desc')
@testimonials = Testimonial.find(:all, :limit => 2, :order=> 'random')
<?php
//If form was submitted
if(isset($_POST['submitted'])) {
$errormsg = ""; //Initialize errors
if(isset($_POST['emailaddress']) && $_POST['emailaddress'] != "Email Address"){
$emailaddress = $_POST['emailaddress']; // If title was entered
}
else{
$errormsg = "* Please enter an email address";
@colmtuite
colmtuite / gist:3285903
Created August 7, 2012 14:40
Error Form
<%= form_for @contact, validate: true do |f| %>
<fieldset>
<div class="input_error">
<%= f.label :message %>
<%= f.text_area :message, autofocus: 'autofocus' %>
<span data-icon="M" class="message">Error message goes here</span>
</div>
<div class="input_success">
<%= f.label :name %>
user.rb
def unfollow!(other_user)
friendships.find_by_followed_id(other_user.id).destroy
end
users/show.html.erb
<% unless @user == current_user %>
<% if current_user.friends_with?(@user) %>
<%= form_for current_user.friendships.find_by_followed_id(@user),
html: { method: :delete } do |f| %>
@colmtuite
colmtuite / gist:6680275
Created September 24, 2013 04:10
Universal margin application
.mas { margin:5px }
.mts { margin-top:5px }
.mrs { margin-right:5px }
.mbs { margin-bottom:5px }
.mls { margin-left:5px }
.mam { margin:10px }
.mtm { margin-top:10px }
.mrm { margin-right:10px }
.mbm { margin-bottom:10px }
@colmtuite
colmtuite / gist:6708535
Created September 26, 2013 01:15
Good use of presentational CSS classes.
<div class="w-30"></div>
<a class="btn-sml btn-accent"></a>
<nav class="horizontal-links"></nav>
<form class="form-stacked"></form>
<form class="form-inline"></form>
.modal {
position:absolute;
top:50%;
left:50%;
width:800px;
height:500px;
margin:-400px 0 0 -250px;
background:#fff;
border:1px solid #eee;
z-index:9999;
Fetching repository, done.
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 286 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/Rails
<!-- Method One -->
<span id="specific-item">Show more</span>
$('#specific-item').click(function() {
$(this).text('Show less');
});