Skip to content

Instantly share code, notes, and snippets.

@mb-dev
mb-dev / gist:3feb7e2b98f1867fde52
Last active August 29, 2015 14:03
Jewish Film Festival

Anywhere else:

![Anywhere else][1] A graduate student in Berlin, Noa seems to be on the right track: She has almost completed her thesis and has just moved in with her German musician boyfriend, Jörg. But when her grant application is turned down, and her advisor deems her project—a dictionary of words that defy translation—unsuitable, all the pressures of living in a foreign country far away from her native Israel are too much for the already stressed-out Noa to handle... http://prod3.agileticketing.net/websales/pages/info.aspx?evtinfo=82364~a70858c6-cd47-4e92-968c-c94c12db6b1c

Site: http://prod3.agileticketing.net/websales/pages/info.aspx?evtinfo=82364~a70858c6-cd47-4e92-968c-c94c12db6b1c& Trailer: https://www.youtube.com/watch?v=bFsIksu6Rz4

  • Castro Theatre - Tue, Jul 29 1:45 PM
@mb-dev
mb-dev / gist:1175448
Created August 27, 2011 14:23
LineItem model
class LineItem
include Mongoid::Document
include Mongoid::Timestamps
TYPE = %w[income expense]
INCOME = 0
EXPENSE = 1
TRANSFER_IN = 'Transfer In'
TRANSFER_OUT = 'Transfer Out'
@mb-dev
mb-dev / posts_controller.rb
Last active December 11, 2015 12:39
Russian Doll Caching - Before - Controller
class PostsController < ApplicationController
def show
@post = Post.includes(comments: :user).find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end
end
@mb-dev
mb-dev / show.html.erb
Last active December 11, 2015 12:39
Russian Doll Caching - View - Before
<div class="post">
<%= render partial: 'post', locals: {post: @post} %>
<hr/>
<div class="comments">
<% @post.comments.each do |comment| %>
<div id="comment-<%=comment.id%>">
<%= comment.user.name %> says:
<p>
@mb-dev
mb-dev / post_presenter.rb
Created January 27, 2013 21:40
Russian Doll Caching - Post Presenter
class PostPresenter
def initialize(post)
@post = post
end
def comments
Comment.includes(:user).where(post_id: @post.id)
end
end
@mb-dev
mb-dev / show.html.erb
Created January 27, 2013 21:39
Russian Doll Caching - View - After
<% cache @post do %>
<div class="post">
<%= render partial: 'post', locals: {post: @post} %>
<hr/>
<div class="comments">
<% @presenter.comments.each do |comment| %>
<% cache comment do %>
<div id="comment-<%=comment.id%>">
@mb-dev
mb-dev / posts_controler.rb
Created January 27, 2013 21:41
Russian Doll Caching - Controller - After
class PostsController < ApplicationController
def show
@post = Post.find(params[:id])
@presenter = PostPresenter.new(@post)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end
end
@mb-dev
mb-dev / mongo_has_many_through.rb
Last active December 11, 2015 20:48
MongoDB Has many through
class Book
field :id
field :title
embeds_many :book_authors
# Mongoid does not offer has_many :through
def authors
book_authors.collect(&:author)
end
@mb-dev
mb-dev / mongo_bucketed_collections
Created January 28, 2013 18:04
MongoDB Bucketed Collections
User:
{
id: 1,
name: 'Joe'
}
MailBucket:
{
user_id: 1,
location: 11,
@mb-dev
mb-dev / mongo_after.rb
Created January 28, 2013 18:02
Storing more data in MongoDB
Book:
{
id: 1,
title: 'Article 1',
authors: [{author_id: 1, name: 'Joe'}, {author_id: 2, name: 'Robert'}]
}