Skip to content

Instantly share code, notes, and snippets.

View MischaTheEvil's full-sized avatar

Mischa The Evil MischaTheEvil

View GitHub Profile
@MischaTheEvil
MischaTheEvil / std_inst_var_in_view
Created September 23, 2014 04:27
Standard instance variables in Rails view(s)
<h1>Debug Info</h1>
<h2>assigns</h2>
<div>
<%= debug(assigns) %>
</div>
<h2>base_path</h2>
<div>
<%#= debug(base_path) %>
</div>
<h2>controller</h2>
@MischaTheEvil
MischaTheEvil / gist:199bb8601ca96d443d5c
Last active August 29, 2015 14:09
rvm/rvm#3144: full session log which displays the unexpected behavior
============
Part one:
============
root@ubuntu:~# cd /var/www/
root@ubuntu:/var/www# type rvm | head -1
rvm is a function
root@ubuntu:/var/www# rvm debug
ruby-2.1.5:
@MischaTheEvil
MischaTheEvil / gist:fc6e4847fbafd6717e6e
Last active August 29, 2015 14:09
rvm/rvm#3144: annotated, command-only summary of the full session
============
Part one:
============
root@ubuntu:~# cd /var/www/
root@ubuntu:/var/www# type rvm | head -1
root@ubuntu:/var/www# rvm debug
# (default) gemset in use by default
root@ubuntu:/var/www# rvm gemset list
root@ubuntu:/var/www# cd redmine-master.local.lan/
# redmine_master gemset selected by using .ruby-gemset file
[root@server redmine.tst.network.lan]# rake test:coverage:html --trace
/opt/ruby-enterprise-1.8.6-20080709/bin/ruby -Ilib:test -S rcov --text-report --rails --aggregate test/coverage.data --exclude '/gems/' -o "test/coverage" "test/unit/wiki_content_test.rb" "test/unit/default_data_test.rb" "test/unit/watcher_test.rb" "test/unit/issue_test.rb" "test/unit/mailer_test.rb" "test/unit/mercurial_adapter_test.rb" "test/unit/query_test.rb" "test/unit/repository_darcs_test.rb" "test/unit/repository_cvs_test.rb" "test/unit/board_test.rb" "test/unit/mail_handler_test.rb" "test/unit/user_test.rb" "test/unit/search_test.rb" "test/unit/custom_field_test.rb" "test/unit/role_test.rb" "test/unit/attachment_test.rb" "test/unit/subversion_adapter_test.rb" "test/unit/time_entry_test.rb" "test/unit/repository_filesystem_test.rb" "test/unit/repository_mercurial_test.rb" "test/unit/activity_test.rb" "test/unit/wiki_test.rb" "test/unit/journal_test.rb" "test/unit/member_test.rb" "test/unit/repository_subversion_test.rb" "test/un
[root@server ~] gem check -a
Performing the 'alien' operation
flog-1.1.0 is error-free
jscruggs-metric_fu-0.8.0 has 1 problems
lib/tasks/metric_fu.rake:
installed file doesn't match original from gem
[root@server ~]# gem list --local
*** LOCAL GEMS ***
actionmailer (2.1.0)
actionpack (2.1.0)
activerecord (2.1.0)
activeresource (2.1.0)
activesupport (2.1.0)
cgi_multipart_eof_fix (2.5.0)
This line (23 of ../vendor/plugins/redmine_charts/app/controllers/charts_groups_controller.rb) doesn't work:
rows = TimeEntry.find(:all, :joins => "left join issues on issues.id = issue_id", :select => select, :conditions => conditions, :readonly => true, :group => group, :order => "sum(hours) desc")
...but this does:
rows = TimeEntry.find(:all, :joins => "left join issues on issues.id = issue_id", :select => select, :conditions => conditions, :readonly => true, :group => group")
Processing ChartsGroupsController#data (for 192.168.1.2 at 2009-01-19 23:30:42) [GET]
Session ID: ff0f14b9c81f66d90891e5ffc6a39868
Parameters: {"project_id"=>"test1", "action"=>"data", "controller"=>"charts_groups", "range_in"=>"weeks", "range_steps"=>"10", "range_offset"=>"1"}
ActiveRecord::StatementInvalid (Mysql::Error: Invalid use of group function: SELECT null as value_x, sum(hours) as value_y, user_id as group_id FROM `time_entries` left join issues on issues.id = issue_id WHERE (`time_entries`.`project_id` = 1) GROUP BY user_id ORDER BY sum(hours) desc):
/opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log'
/opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:302:in `execute'
/opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapt
@MischaTheEvil
MischaTheEvil / redmine_tab_plugin.patch
Created February 6, 2009 18:49
This patch changes the URL-params and reintegrates pcf-value holder for iframe-links.
Index: app/controllers/tab_controller.rb
===================================================================
--- app/controllers/tab_controller.rb (revision 210)
+++ app/controllers/tab_controller.rb (working copy)
@@ -1,38 +1,39 @@
-# tab_controller.rb
-#
-# Copyright 2008 James Turnbull <james@lovedthanlost.net>
-#
-# This program is free software; you can redistribute it and/or modify
@MischaTheEvil
MischaTheEvil / plugin_settings.rhtml
Created April 5, 2009 01:38
Getting a "nested" setting
<p>
<label><%= l(:setting_collapse_menustab) %></label>
<%= check_box_tag 'settings[show_menus_tab]', 1, Setting.plugin_redmine_collapse['show_menus_tab'] == '1', :onclick=>"Element.toggle('menustab_content'); return true;" %><%= hidden_field_tag 'settings[show_menus_tab]', 0 %>
</p>
<div id="menustab_content" <%= Setting.plugin_redmine_collapse['show_menus_tab'] == '1' ? '' : 'style="display:none"' %>>
<p>
<label><%= l(:setting_collapse_pmtab) %></label>
<%= select_tag 'settings[show_projectmenu_tab]', options_for_select( [[l(:general_text_No), "0"], [l(:general_text_Yes), "1"]], @settings ['show_projectmenu_tab'] ) %>
</p>