Skip to content

Instantly share code, notes, and snippets.

require 'delegate'
class Child
def open
"HELLO WORLD"
end
def ping
"PING"
end
end
module Lukes::Core::Module
extend ActiveSupport::Concern
included do
include ActiveModel::Validations
end
end
65 scenarios (65 passed)
280 steps (280 passed)
0m4.091s
Run options: --seed 8782
# Running tests:
<%= form_for :question, :url => step1_path do -%>
<% for question in @questions %>
<%= fields_for "answers[]", Answer.new(question_id: question.id) do |li_fields| %>
<%= li_fields.label :title, question.title %>
<%= li_fields.hidden_field :question_id %>
<%= li_fields.text_field :weight %>
<% end %>
<% end %>
<%= submit_tag "Create line items" %>
<% end %>
@jamesalmond
jamesalmond / gist:5759979
Created June 11, 2013 19:46
Garmin Maps Error
{
"Message": "An error has occurred.",
"ExceptionMessage": "com.garmin.service.exception.ServiceException: java.lang.NullPointerException",
"ExceptionType": "System.ServiceModel.FaultException`1[[Garmin.Cartography.Services.Rce.WebServiceWrapper.ITMapUpdateServiceReference.ServiceException, Garmin.Cartography.Services.Rce.WebServiceWrapper, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null]]",
"StackTrace": "\r\nServer stack trace: \r\n at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n at System.Runtime.Remotin
Fixnum.class_eval do
def percent_of_the_time
if (rand * 100) < self
yield
end
end
end
80.percent_of_the_time do
puts "LAL"
require 'simple_form'
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# ....
end
@jamesalmond
jamesalmond / gist:2118420
Created March 19, 2012 16:35
CRUD controller
class NewController < SomeOtherController
include Cms::Controller
crud_for ArticleManager
add_rescue :create, SomeOtherError do |error|
redirect_to root_path
end
end
source "http://rubygems.org"
gem 'goliath', :git => "git://github.com/postrank-labs/goliath.git"
@jamesalmond
jamesalmond / gist:1015577
Created June 8, 2011 22:20
Rails Installation