Skip to content

Instantly share code, notes, and snippets.

@irissilvermoon
irissilvermoon / backtrace_WL
Created March 12, 2013 18:01
wishlist migration backtracs
* Invoke db:migrate:down (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant Users
/Users/karen/Desktop/Programs/Wishlist/app/admin/users.rb:1:in `<top (required)>'
/Users/karen/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/lib/active_admin/application.rb:190:in `block in load!'
/Users/karen/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/lib/active_admin/application.rb:190:in `each'
/Users/karen/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/lib/active_admin/application.rb:190:in `load!'
/Users/karen/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/lib/active_admin/application.rb:213:in `routes'
@irissilvermoon
irissilvermoon / AAbacktrace
Created March 12, 2013 20:15
active admin backtrace
karen@karen:~/desktop/Programs/wishlist (master)⚡ ➔ rails generate active_admin:install User
invoke devise
generate No need to install devise, already done.
invoke active_record
create db/migrate/20130312200819_add_devise_to_users.rb
insert app/models/user.rb
route devise_for :users
gsub app/models/user.rb
gsub config/routes.rb
@irissilvermoon
irissilvermoon / palindrome.rb
Created April 3, 2013 18:33
palindrome program
def palindrome?(string)
head = 0
tail = string.length - 1
while string[head] == string[tail]
head += 1
tail -= 1
if tail < head
puts 'palindrome'
else
@irissilvermoon
irissilvermoon / destroy.rb
Last active December 15, 2015 19:59
what i put here?
def destroy
@watched_user = current_user.watched_users.find(params[:id])
@subscription = current_user.outbound_subscriptions.where(:watching_id => @watching.id).first
@subscription.destroy
flash[:notice] = "#{@watched_user.email} was removed from watchers."
redirect_to watched_users_path
end

What's the name (or codename) of your app?

Wishlist

What will your app do?

Wishlist is for users who get those pesky emails from family members regarding what they want for their birthday, holidays, anniversary, etc. Rather than sending an email back or having to wrack your brain with what you want you can invite them to view your wishlist! Wishlists are broken down into categories based on how the user would like to split them up (household items, things i want for my birthday, that sort of thing). Within each wishlist will contain a list of items. Items have fields such as name, description, cost, link to the item and an image.

my code:
$(document).ready(function() {
$('#tour').on('click', 'button', function() {
$('.photos').slideToggle();
});
function showPhotos () {
$(this).find('span').slideToggle();
}
#factory:
FactoryGirl.define do
factory :user do
email "wishlist@example.com"
username "User"
password "password"
password_confirmation "password"
factory :confirmed_user do
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}
.wishlist-grid {
background: #cbcccd;
float: left;
min-height: 200px;
min-width: 200px;
max-height: 200px;
max-width: 200px;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
require 'spec_helper'
describe PurchasesController do
let!(:user) { Factory(:confirmed_user) }
let!(:watching_user) do
u = Factory(:confirmed_user)
user.watchers << u
u
end