Skip to content

Instantly share code, notes, and snippets.

View benmoss's full-sized avatar
🙈

Ben Moss benmoss

🙈
View GitHub Profile
$(window).load(function() {
$(".carousel").each(function() {
id = "#" + $(this).attr("id");
$(id + " .carousel").jCarouselLite({
btnNext: id + " .next-gallery",
btnPrev: id + " .previous-gallery",
visible: 1
});
});
});
@benmoss
benmoss / deploy.rb
Created April 19, 2011 14:38
Configuring a remote sphinx server with Thinking Sphinx
# deploy.rb
namespace :ts_remote do
task :conf do
run <<-CMD
cd #{current_release}
&&
RAILS_ENV=#{rails_env} rake ts:conf
&&
rsync --progress #{current_release}/config/#{rails_env}.sphinx.conf sphinxsearch@db-server:/home/sphinxsearch/
@benmoss
benmoss / AuthenticationHelpers.rb
Created April 22, 2011 18:54
Authlogic UserSessionsController
module AuthenticationHelpers
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
---------- Loading database fixtures
rake aborted!
PGError: ERROR: duplicate key value violates unique constraint "sessions_pkey"
DETAIL: Key (id)=(1) already exists.
: INSERT INTO "sessions" ("name", "created_at", "updated_at", "end_year", "id", "legislature_id", "start_year") VALUES ('112th Congress', '2011-05-04 23:52:30', '2011-05-04 23:52:30', 2012, 1, 1, 2011)
var deleteLinks = $('li.comment a[data-remote=true]');
deleteLinks.live('ajax:complete', function(event, xhr, status) {
$(this).parents("div.post-content").append(xhr.responseText);
$(this).parents("div.comment-stream").remove();
});
deleteLinks.live('ajax:error', function(event) {
alert('sorry, something seems to have gone badly, please try again');
});
@benmoss
benmoss / gist:1046982
Created June 25, 2011 22:41
Carrierwave Rails 3.1rc4 error
NoMethodError in Podcasts#show
Showing /code/podcaster/app/views/podcasts/show.html.haml where line #13 raised:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
Extracted source (around line #13):
10: = @podcast.description
⚡ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
no such file to load -- fog
/Users/benjaminmoss/.rvm/gems/ruby-1.9.2-p180@rickrockstar/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
/Users/benjaminmoss/.rvm/gems/ruby-1.9.2-p180@rickrockstar/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
/Users/benjaminmoss/.rvm/gems/ruby-1.9.2-p180@rickrockstar/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/Users/benjaminmoss/.rvm/gems/ruby-1.9.2-p180@rickrockstar/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
⚡ refinerycms rickrockstar
Running: "/Users/benjaminmoss/.rvm/rubies/ruby-1.9.2-p180/bin/ruby" -S bundle install
Fetching source index for http://rubygems.org/
Installing rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
****************************************
* Installing vwilight *
****************************************
** Invoke vwilight:install (first_time)
** Invoke after (not_needed)
** Invoke autoload (not_needed)
** Invoke doc (not_needed)
** Invoke plugin (not_needed)
** Invoke ruby (not_needed)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6353 100 6353 0 0 22639 0 --:--:-- --:--:-- --:--:-- 50824
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
fetching: http://registry.npmjs.org/npm/-/npm-1.0.94.tgz
0.4.11
1.0.94
cleanup prefix=/usr