Skip to content

Instantly share code, notes, and snippets.

View dgutov's full-sized avatar

Dmitry Gutov dgutov

View GitHub Profile
@dgutov
dgutov / single_recipient_smtp.rb
Created March 16, 2012 12:24 — forked from croaky/single_recipient_smtp.rb
Set staging environment email to go to a single email address you control in order to not accidentally send production email addresses staging data.
module SingleRecipientSmtp
def self.included(clazz)
clazz.class_eval do
cattr_accessor :single_recipient_smtp_settings
end
end
def perform_delivery_single_recipient_smtp(mail)
mail.to = single_recipient_smtp_settings[:to]
mail.cc = nil
@dgutov
dgutov / paginated_collection.js
Created April 18, 2012 00:47 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {