Skip to content

Instantly share code, notes, and snippets.

View ahawkins's full-sized avatar
💭
🌈🏄🏼‍♂️🤙🏻

Adam Hawkins ahawkins

💭
🌈🏄🏼‍♂️🤙🏻
View GitHub Profile
@ahawkins
ahawkins / core_state.js
Created January 21, 2011 04:42
account_page.js
sc_require('core');
// Overall statechart for the application
Admin.statechart = Ki.Statechart.create({
// Set tracing on to debug statecharts
trace: YES,
rootState: Ki.State.design({
:search => {
:keywords => 'asdfkljsdflkjsf',
:conditions => {
[:attribute => :name, :operator => '==', :value => 'xxx'],
[:attribute => :contacted_at, :operator => '>=', :value => 'xxx],
[:attribute => :contacted_at, :operator => '<=', :value => 'xxx]
}
}
# here is a small piece of trickery to assign the remindable assoication
# when reminder_attributes=(attrs) is called.
# When using nested_attributes/build we have a problem in the reminder model
# since Todo.new(:reminder_attributes => {:something => :good}).reminder returns a reminder
# however Todo.new(:reminder_attributes => {:valid => :attributes}).reminder.remindable returns nil
# this alias sets the todo as the in memory object so the reminder can access the parent
def reminder_attributes_with_assign_todo=(reminder_attrs)
self.reminder_attributes_without_assign_todo = reminder_attrs.merge(:remindable => self)
end
alias_method_chain :reminder_attributes=, :assign_todo
- search_form_for(@customer_search) do |form|
= form.keywords
= form.search_fields
= form.highlight_options
= form.conditions
= form.order_options
= form.pagination_options
= form.buttons
undefined local variable or method `node' for #<Capybara::Driver::Node tag="a" path="/html/body/a"> (NameError)
./features/step_definitions/web_steps.rb:35:in `block (2 levels) in <top (required)>'
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:34:in `/^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/'
features/sign_in_with_gitub.feature:5:in `Then I follow "Sign in with Github"'
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
@ahawkins
ahawkins / api_helper.rb
Created February 7, 2011 04:25
api_steps.rb
module ApiHelper
def post_json(hash, path)
uri = URI.parse(@api_server.url(path))
request = Net::HTTP::Post.new(uri.path)
request.content_type = 'application/json'
request.body = ActiveSupport::JSON.encode(hash)
response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(request) }
end
@ahawkins
ahawkins / gist:816101
Created February 8, 2011 08:30
solrconfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@ahawkins
ahawkins / gist:816103
Created February 8, 2011 08:32
schema.xml
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Chatter.userController = SC.ObjectController.create(
/** @scope Chatter.userController.prototype */ {
loggedInAs: function(){
return "Logged in as " + this.get('name');
}.cacheable()
}) ;