This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% data.stories.each_slice(4) do |chunk| %> | |
<div class="m-box"> | |
<% chunk.each do |d| %> | |
<div class="m-boxes__quarter" style="background-image: url('<%= d.image %>');"> | |
<h6><a href="<%= d.url %>" target="new"><%= d.headline %></a></h6> | |
</div> | |
<% end %> | |
</div> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
select transactions.*, exchange_rate.rate | |
join exchange_rate on transcations.month = exchange_rate.month | |
) | |
union | |
( | |
select predictions.*, (select rate from exchange_rate order by month desc limit 1) as rate | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select stuff.*, if( | |
exchange_rate.rate is null, | |
(select rate from exchange_rates order by month desc limit 1), | |
exchange_rate.rate | |
) | |
from stuff | |
left outer join exchange_rate on exchange_rate.stuff_id = stuff.id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select billings.cost, employees.name | |
from ( | |
select cost, employee_id from past_billings | |
union | |
select (hours * rate) as cost from future_billings | |
) billings | |
join employees on employees.id = billings.employee_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://assets.sbnation.com/features/2013-NHL-Preview/tentpole.min.js"></script> | |
<script type="text/javascript"><!-- | |
jQuery(function($) { $('.feature-body').css("height",$(window).height()) }); | |
// --></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function goTo(page) { | |
var callback = function(e, adMarkup) { | |
if (page < bb.current) { | |
// Insert AFTER the requested page, if moving backwards | |
page += 1; | |
} | |
insertAdBeforePage(adMarkup, page); | |
}; | |
$(document).on('renderTentpoleFeatureAd', callback); | |
$(document).trigger('tentpoleFeaturePageFlip', pagesSeen, bb.current, page); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Models.Comment = Backbone.Model.extend(_.extend({}, App.Mixins.Ajax, { | |
urls: { | |
flag: '/comments/flag_comment/:id' | |
}, | |
flag: function(formData) { | |
this.set('is_flagged', true); | |
return this.ajax('flag', { | |
data: formData, | |
error: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Views.CommentList = Backbone.View.extend({ | |
childrenById: {}, | |
childSelector: 'div', | |
childView: function() { | |
return App.Views.Comment; | |
}, | |
// Bind child event handlers once, instead of once per child view | |
delegateEvents: function() { | |
// Call super |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Mixins.Ajax = { | |
// Override urls in the target object to contain a map of | |
// actionName => /url/path/with/:bound/:segments | |
urls: {}, | |
// Any options specified here are merged with those you pass to | |
// this.ajax({...}) before being passed to jQuery.ajax | |
ajaxOptions: {}, | |
// Return the matching url from the 'urls' object, with /:path/:segments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Mixins.Ajax = { | |
... | |
}; | |
App.Models.Comment = Backbone.extend(_.extend({}, | |
// Mixins | |
App.Mixins.Ajax, { | |
// Methods | |
initialize: function() { |