Skip to content

Instantly share code, notes, and snippets.

@vpamulap
vpamulap / gist:1754562
Created February 6, 2012 20:18
This is the code used to replace a recipe on a page using ajax.
______________________________________________
Link to Action in View:
______________________________________________
<%= link_to image_tag("refreshIcon.png"), replace_meal_queue_recipe_path(meal_queue_recipe), method: :post, remote: true %>
______________________________________________
Controller:
______________________________________________
class MealQueueRecipesController < ApplicationController
# GET /meal_queue_recipes
@vpamulap
vpamulap / initializer
Created February 20, 2012 07:42
config/initializers/recommendable.rb
require "redis"
require "resque"
require "resque-loner"
ENV["REDISTOGO_URL"] ||= "redis://vpamulap:1a987fbf3a3fc0623964631159493a29@chubb.redistogo.com:9220/"
uri = URI.parse(ENV["REDISTOGO_URL"])
# Recommendable requires a connection to a running redis-server. Either create
@vpamulap
vpamulap / gist:1882991
Created February 22, 2012 07:20
recommendable exception
Worker
304a9f87-46eb-4e7d-8128-98d9b378813f:1 on RECOMMENDABLE at 13 minutes ago Retry or Remove
Class
Recommendable::RecommendationRefresher
Arguments
23
@vpamulap
vpamulap / gist:2150185
Created March 21, 2012 17:50
how do I test this?
class ShoppingList < ActiveRecord::Base
belongs_to :user
has_many :shopping_list_ingredients
has_many :ingredients, through: :shopping_list_ingredients
serialize :current_mqrs
@vpamulap
vpamulap / gist:2152451
Created March 21, 2012 20:19
How would I unit test add_to_shopping_list?
class MealQueueRecipe < ActiveRecord::Base
belongs_to :meal_queue
belongs_to :recipe
after_create :add_to_shopping_list
after_destroy :remove_from_shopping_list
def add_to_shopping_list
sl = get_shopping_list
sl.add_mqr(self)
@vpamulap
vpamulap / gist:2304749
Created April 4, 2012 18:58
Resque Status Hash Problem
Added in gemfile:
gem 'resque-status'
My Initializer: resque.rb
require 'resque/job_with_status'
Resque.redis = 'localhost:6379'
Resque::Plugins::Status::Hash.expire_in = (24 * 60 * 60)
________________________________________________
Neilcomp-2:saute vpamulap$ otool -L /usr/local/bin/psql
/usr/local/bin/psql:
/usr/local/Cellar/postgresql/9.1.3/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.4.0)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
/usr/local/Cellar/readline/6.2.2/lib/libreadline.6.2.dylib (compatibility version 6.0.0, current version 6.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
resources :orders do
get "userindex", :on => :collection
#get "status", :on => :member
end
doing localhost:3000/orders/userindex runs the show action and tries to find the order with id userindex
The following is posted only in defense, and not as an attack, Salman and Dov are great guys:
To those sharing, liking, and commenting on this blog post, please realize that you are seeing and promoting only one side of a two-sided story. We behaved in a fully ethical manner by handing over all rights to Weekly Eats while claiming none of the UX and design work that provably came from us alone. The claims that we stole or didn't value Salman's work are false.
To claim the UX and UI drawn on the pictured whiteboard (drawn literally days before we went our own ways) as his deliverable is disingenuous. The depicted UI was provably developed and designed independently by Neil and I (this can be proven if Salman chooses to share the campfire logs, not to mention our personal github repos), and we chose to share our thoughts with him and Dov in person that day. Frankly, none of us came up with the "novel" idea of the shopping list (see designmymeals.com, feastie.com, pepperplate.com, emeals.com, allrecipes.com,
@vpamulap
vpamulap / gist:2992279
Created June 26, 2012 00:21
nginx config
upstream unicorn {
server unix:/tmp/unicorn.saute.sock fail_timeout=0;
}
server {
listen 80;
server_name sautenow.com *.sautenow.com;
root /home/deployer/apps/saute/current/public;
location ^~ /assets/ {