Skip to content

Instantly share code, notes, and snippets.

local:1.9.2% git clone mojombo/grit
Initialized empty Git repository in /home/jbbarth/dev/grit/.git/
remote: fatal: Could not switch to '/data/repositories/a/a8/e2/95/mojombo': No such file or directory
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed
#same with proxymachine...
local:1.9.2% git clone mojombo/proxymachine
Initialized empty Git repository in /home/jbbarth/dev/proxymachine/.git/
@jbbarth
jbbarth / output.txt
Created July 15, 2011 10:37
Cloning redmine_events
% git clone https://git.fachschaften.org/redmine-events
Initialized empty Git repository in /home/jbbarth/dev/redmine/redmine-events/.git/
got 2048f30a53ed5d52a31fc2d664344d70f331f411
walk 2048f30a53ed5d52a31fc2d664344d70f331f411
got 447f6d2fec34a77c910a929f3def8c7e55f1d2d2
got 89b477fbb6c99668ad0336d6f897137488078eeb
got 9995164130e63a57314176a69e8f5edd5dc8de18
walk 89b477fbb6c99668ad0336d6f897137488078eeb
got e4860cadba851070e42d7de72f3eddb65f5ced37
got ae030a6c6087b85a1352275df82906df9dc8a298
@jbbarth
jbbarth / gist:3029163
Created July 1, 2012 18:20
Testing my redmine_sudo plugin
% export RAILS_ENV=test
% rake db:reset db:create db:migrate redmine:plugins >/dev/null
% rails runner '$stderr.puts User.column_names.include?("sudoer")' >/dev/null
true
% rake test
[...fail fail fail...]
% rails runner '$stderr.puts User.column_names.include?("sudoer")' >/dev/null
@jbbarth
jbbarth / deface_patch.rb
Created July 30, 2012 10:54
Awful monkey patch for deface bug #59
# See: https://github.com/railsdog/deface/issues/59
ActionView::Template.class_eval do
def initialize_with_deface_patch(source, identifier, handler, details)
if handler.class.to_s.demodulize == "ERB"
initialize_without_deface_patch(source, identifier, handler, details)
else
initialize_without_deface(source, identifier, handler, details)
end
end
@jbbarth
jbbarth / gist:3519760
Created August 29, 2012 22:33
Thanks active_support :/
>> Date.current
=> Wed, 29 Aug 2012
>> Date.today
=> Thu, 30 Aug 2012
>> Date.tomorrow
=> Thu, 30 Aug 2012
@jbbarth
jbbarth / model.rb
Created September 12, 2012 01:14
ActiveRecord, has_many :include, has_many :through
class User < ActiveRecord::Base
has_many :memberships, :include => :roles
has_many :projects, :through => :memberships
end
User.first.memberships
#=> eager loads "roles"
User.first.projects
#=> does NOT eager loads "roles"
@jbbarth
jbbarth / fix_scn_headers_middleware.rb
Created December 31, 2012 14:18
Rack middleware for Redmine to fix bad effects of our 2nd reverse-proxy
require 'rack/utils'
class FixScnHeadersMiddleware
def initialize(app)
@app = app
end
def call(env)
if env["HTTP_X_FORWARDED_HOST"]
env["HTTP_X_FORWARDED_HOST"].gsub!(/,\s?[^,]+.ac.cs$/,"")
@jbbarth
jbbarth / login.rb
Created March 1, 2013 18:31
deface override to fix a problem at work
Deface::Override.new :virtual_path => 'account/login',
:name => 'fix-back-url-escape',
:insert_before => '#login-form',
:text => '<% params[:back_url] = CGI.unescape(params[:back_url]) if params[:back_url].match(/^https?%/) %>'
@jbbarth
jbbarth / error.txt
Created March 21, 2013 14:18
Error when trying to create a new bucket on Riak CS
% s3cmd --debug mb s3://zbucket
DEBUG: ConfigParser: Reading file '/Users/jbbarth/.s3cfg'
DEBUG: ConfigParser: access_key->X2...17_chars...C
DEBUG: ConfigParser: bucket_location->US
DEBUG: ConfigParser: default_mime_type->binary/octet-stream
DEBUG: ConfigParser: delete_removed->False
DEBUG: ConfigParser: dry_run->False
DEBUG: ConfigParser: encoding->UTF-8
DEBUG: ConfigParser: encrypt->False
DEBUG: ConfigParser: follow_symlinks->False
@jbbarth
jbbarth / riak-cs_app.config
Created March 22, 2013 06:58
Riak CS config files
[
{lager, [
{crash_log, "/var/log/riak-cs/crash.log"},
{crash_log_count, 5},
{crash_log_date, "$D0"},
{crash_log_msg_size, 65536},
{crash_log_size, 10485760},
{error_logger_redirect, true},
{handlers, [
{lager_file_backend, [