Skip to content

Instantly share code, notes, and snippets.

class Account
attr_accessor :balance
def initialize(amount)
@balance = 0 || amount if amount.length
end
def history
@history ||= Array.new
@telagraphic
telagraphic / Gemfile
Created October 16, 2012 23:32
rvm do all cucumber
source :rubygems
#ruby=1.9.2
group :test do
gem 'cucumber', '1.1.3'
gem "rspec-expectations", "~> 2.11.3"
gem "savon", "~> 1.2.0"
gem "httpi", "~> 1.1.1"
gem "test-unit", "~> 2.5.2"
gem "rspec", "~> 2.11.0"
@telagraphic
telagraphic / $GEM_PATH, $PATH
Created October 16, 2012 22:53
jenkins build output
+ which cucumber
/home/pillar/.rvm/gems/ruby-1.9.2-p320/bin/cucumber
+ whoami
jenkins
+ pwd
/var/lib/jenkins/jobs/c2f-webservice-cucumber/workspace
+ echo 'file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/stapler-jruby-1.177.jar!/gem'
file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/stapler-jruby-1.177.jar!/gem
+ echo /sbin:/usr/sbin:/bin:/usr/bin:/etc/alternatives/anthome:/home/pillar/.rvm/gems/ruby-1.9.2-p320/bin:/home/pillar/.rvm/rubies/ruby-1.9.2-p320/bin/:/usr/local/maven/bin::/usr/local/maven/bin:/home/pillar/.rvm/gems/ruby-1.9.2-p320/bin:/home/pillar/.rvm/gems/ruby-1.9.2-p320@global/bin:/home/pillar/.rvm/rubies/ruby-1.9.2-p320/bin:/home/pillar/.rvm/bin:/usr/lib64/qt-3.3/bin:/usr/local/maven/bin::/usr/local/bin:/usr/bin:/bin:home/pillar/.rvm/gems/ruby-1.9.2-p320/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/pillar/.rvm/bin:/home/pillar/bin:/home/pillar/.rvm/bin:home/pillar/.rvm/gems/ruby-1.9.2-p320/bin
/sbin:/usr/sbin:/bin:/usr/bin:/etc/alternatives/anthome:/home/pillar/.rvm/gems/ruby-1.9.2-p320
@telagraphic
telagraphic / incorrect path...
Created October 16, 2012 14:34
Jenkins Environment Variables
Started by user anonymous
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/jobs/WebServiceCucumber/workspace
Checkout:workspace / /var/lib/jenkins/jobs/WebServiceCucumber/workspace - hudson.remoting.LocalChannel@6fa053d5
Using strategy: Default
Last Built Revision: Revision c68c082c3c0290916d8c0a088d5ed462184e033f (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from https://github.com/nickcin/c2f-wsdl.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
@telagraphic
telagraphic / console output
Created October 15, 2012 16:45
Jenkins Failure
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
class ActionStepsController < ApplicationController
def create
@project = current_user.projects.find(params[:project_id]) # project.rb has a belongs_to :user and user_id column
@sub_project = @project.sub_projects.find(params[:sub_project_id])
@action = @sub_project.action_steps.build(params[:action_step])
if @action.save
redirect_to [current_user, @project, @sub_project]
else
render "sub_projects/show"
@telagraphic
telagraphic / routes.rb
Created September 26, 2012 14:26
Devise Set-Up
LifeUlator::Application.routes.draw do
get "status_updates/index"
devise_for :users do
resources :days
end
resources :users do # or do devise_for :users do
resources :projects
@telagraphic
telagraphic / application.html.erb
Created September 16, 2012 14:21
devise session not applying to each user...
<!DOCTYPE html>
<html>
<head>
<title>Life</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
@telagraphic
telagraphic / index.html.erb
Created September 15, 2012 21:35
accessing datetime values...
<h1>Sleep Tracking</h1>
<%= link_to "New Day", new_sleep_path %>
<% @sleep.each do |s| %>
<p>Woke at : <%= s.wake %></p>
<% end %>
class FeedsController < ApplicationController
def index
@day = Day.find(params[:day_id])
@feed = @day.feeds.build # build association object
@feeds = @day.feeds.all # list all feed submits
end
def create
@day = Day.find(params[:day_id])