Skip to content

Instantly share code, notes, and snippets.

View trosage's full-sized avatar
🏠
Working from home

Tyson Rosage trosage

🏠
Working from home
View GitHub Profile
def form_div(form, field, message = nil, options = {}, &block)
style_class = options[:class] || ""
style_class += " error" if form.object.errors[field].any?
div_options = {}
div_options[:class] = style_class unless style_class.blank?
buffer = ""
buffer << content_tag("div", div_options) do
inner_buffer = yield
$('.form-button-group').each(function(i, elem) {
$elem = $(elem);
var button = elem.find(".button");
var width = (parseInt(button.width()));
alert(width);
$elem.css({
paddingRight: width
});
});
Original
<%= link_to("Download", @video.assets_url, :class => "button button-small button-generic") unless @video.assets.blank? %>
What I want to work
<% if @video.assets.blank? %>
<li>
def tooltip(location, &block)
content = capture(&block)
tooltip_carrot = "<span class=\"icon icon-tooltip-carrot\"></span>".html_safe
content_tag(:span, (content + tooltip_carrot), :class => "tooltip tooltip-#{location}")
end
// I want a param that I can set that will add this line of code (below) before the tooltip_carrot snippet is added. I want the param to be optional so if I dont set it the code just wont be added.
<a class=\"close-tooltip\"><span class=\"icon icon-close-tooltip\"></span></a>
def tooltip(location, close=false, &block)
content = capture(&block)
if close == true
"<a class=\"close-tooltip\"><span class=\"icon icon-close-tooltip\"></span></a>".html_safe
end
tooltip_carrot = "<a class=\"close-tooltip\"><span class=\"icon icon-close-tooltip\"></span></a><span class=\"icon icon-tooltip-carrot\"></span>".html_safe
content_tag(:span, (content + tooltip_carrot), :class => "tooltip tooltip-#{location}")
end
img
width: 116px
-webkit-animation: swing 3s infinite ease-in-out
-webkit-transform-origin: top
-moz-animation: swing 3s infinite ease-in-out
-moz-transform-origin: top
float: left
margin: -40px 0px 0 -130px
.topic-dev
img
<% if child.code_challenge? && !logged_in? %>
<%= badge_image child, :alt => "", :class => "object-image" %>
<h4><%= child.title %></h4>
<% else %>
<%= link_to_unit child do %>
<%= badge_image child, :alt => "", :class => "object-image" %>
<% if current_user && current_user.has_badge?(child.badge) %>
<span class="icon icon-unlocked-badge-small"></span>
<% end %>
class NavLabels
constructor: () ->
$label = $(this).find(".nav-label-container")
mouseIn = () ->
$label.animate {
opacity: 1
top: 45
}, 400
$("#topic-tabs a").live("click", function(){
$("#topic-tabs a").removeClass("selected");
$(this).addClass("selected");
});
$(".topic-tab-all").live("click", function(){
$(".topic").show();
});
$(".topic-tab-design").live("click", function(){
$(".topic").hide();
$("#topic-tabs a").on("click", function(){
$("#topic-tabs a").removeClass("selected");
$(this).addClass("selected");
});
$(".topic-tab-all").on("click", function(){
$(".topic-group").show();
});
$(".topic-tab-design").on("click", function(){
$(".topic-group").hide();