This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
def test_that?(n) | |
return n < 12 | |
end | |
class MyID < DelegateClass(Integer) | |
def initialize(num) | |
@small = false | |
if test_that?(num) | |
@small = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_email_issue_attributes(issue, user, html=false) | |
exclude = %w{category fixed_version} | |
items = email_issue_attributes(issue, user) | |
# filter items outputed | |
items = items.select {|i| ! exclude.include?(i) } | |
output = [] | |
# content_tag() will escape if it recieve string not block | |
items.each do |i| | |
if html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from rails console | |
# foo is defined https://gist.github.com/Sylvain303/5899c453579871bfbfc4 | |
# here redmine issue helper | |
foo = ActionView::Base.new | |
foo.extend IssuesHelper | |
foo.extend CustomFieldsHelper | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# here redmine issue helper | |
foo = ActionView::Base.new | |
foo.extend IssuesHelper | |
foo.extend CustomFieldsHelper | |
issue = Issue.find_by_id(770) | |
user = User.find_by_id(748) | |
foo.render_email_issue_attributes(issue, user, true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def change(type, old_name, new_name) | |
case type | |
when :role | |
klass = Role | |
field = :name | |
when :group | |
klass = Group | |
field = :lastname | |
else | |
raise "unsupported type:#{type}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('liste_conf.php'); | |
/* | |
$adminpw = 'secret'; | |
$LIST_URL = 'https://mailman.server.url/cgi-bin/mailman/'; | |
*/ | |
if(count($_GET) > 1) | |
{ | |
$list = $_GET['l']; |