-
Куча / Говнокод #7654
+135
Комментарии (27) -
Куча / Говнокод #7653
+146
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
Делфи есть светочь всего человечества... и мне всё пофиг... СИонистам просьба тут слюной не брызгать... тут обсуждать только величие великого паскаля и его семейство... можно также чуть чуть о обероне и модуле... положительно воспринимаються стихи и песни про дельфиноф в героическом ракурсе (например о героических победах в холиварах против СИПиПишникоф) всякие джокеры, лакмусы и прочие нупы - фтопку, кг/ам, йаду...http://www.gamedev.ru/flame/forum/?id=12560Комментарии (16) -
Куча / Говнокод #7652
+144
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
# /* [ <!-- */ include <stdio.h> /* \ #{\ `""""true \\#{"\n#"}; \ \ if [ -n "$ZSH_VERSION" ]; then \ \ echo exec echo I\'m a zsh script.; \ \ elif [ -n "$BASH_VERSION" ]; then \ \ echo exec echo I\'m a bash script.; \ else \ echo exec echo I\'m a sh script.; \ fi`; #\ BEGIN{print"I'm a ", 0 ? "Ruby" :"Perl", " program.\n"; exit; } #\ %q~ set dummy =0; puts [list "I'm" "a" "tcl" "script."]; exit all: ; @echo "I'm a Makefile." \ #*/ /*: */ enum {a, b}; \ \ static int c99(void) { #ifndef __cplusplus /* bah */ unused1: if ((enum {b, a})0) \ (void)0; #endif unused2: return a; \ } \ static int trigraphs(void) { \ \ return sizeof "??!" == 2; \ } \ char X; \ \ int main(void) { \ \ struct X { \ \ char a[2]; \ };\ if (sizeof(X) != 1) { \ \ printf("I'm a C++ program (trigraphs %sabled).\n", \ \ trigraphs() ? "en" : "dis");\ \ }else if (1//**/2 )unused3 : { ; \ printf("I'm a C program (C%s, trigraphs %sabled).\n", \ c99() ? "89 with // comments" : "99", \ trigraphs() ? "en" : "dis"); \ } else { \ printf("I'm a C program (C89, trigraphs %sabled).\n", \ trigraphs() ? "en" : "dis"); \ } \ return 0; \ } /* # \ > main :: IO () -- -- \ > main = putStr "I'm a Literate Haskell program.\n" # \ ]>++++++++[<+++++++++>-]<+.>>++++[<++++++++++>-]<-.[-]>++++++++++ \ [<+++++++++++>-]<-.>>++++[<++++++++>-]<.>>++++++++++[<++++++++++> \ -]<- - -.<.>+.->>++++++++++[<+++++++++++>-]<++++.<.>>>++++++++++[ \ <++++++++++>-]<+++++.<<<<+.->>>>- - -.<+++.- - -<++.- ->>>>>+++++ \ +++++[<+++++++++++>-]<- - -.<<<<<.<+++.>>>.<<<-.- ->>>>+.<.<.<<.> \ ++++++++++++++.[-]++++++++++"""` # \ print "I'm a Python program."; """[-][--><html><head> <!--:--><title>I'm a HTML page</title></head><body> <!--:--><h1>I'm a <marquee><blink>horrible HTML</blink></marquee> page</h1> <!--:--><script language="JavaScript"> <!--: # \ setTimeout( // \ function () { // \ document.body.innerHTML = "<h1>I'm a javascript-generated HTML page</h1>"; // \ }, 10000); // \ //--> </script><!--: \ </body></html><!-- } # \ say "I'm a Perl6 program", try { " ($?PUGS_VERSION)" } // "", "."; # """ # */ #define FOO ]-->~Может боян, конечно, но этот код реально компилится и работает на 15 разных языках программирования без изменений.
Работает в C(x2), C++, Haskell, Ruby, Python, Perl(x2), HTML, tcl, bash, zsh, make, bash и brainfuck.Комментарии (18) -
PHP / Говнокод #7651
+147
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
$prim = mysql_result($result,$i,"prim"); $gruz = mysql_result($result,$i,"gruz"); $kuzov = mysql_result($result,$i,"kuzov"); $o_strana = mysql_result($result,$i,"o_strana"); $o_gorod = mysql_result($result,$i,"o_gorod"); $k_strana = mysql_result($result,$i,"k_strana"); $k_gorod = mysql_result($result,$i,"k_gorod"); $stavka = mysql_result($result,$i,"stavka"); $data = mysql_result($result,$i,"data"); $m3 = mysql_result($result,$i,"m3"); $ves = mysql_result($result,$i,"ves"); $valuta = mysql_result($result,$i,"valuta"); $firstname = mysql_result($result,$i,"firstname"); $lastname = mysql_result($result,$i,"lastname"); $middlename = mysql_result($result,$i,"middlename"); $phone = mysql_result($result,$i,"phone"); $cb_icq = mysql_result($result,$i,"cb_icq"); $cb_skype = mysql_result($result,$i,"cb_skype"); $cb_company = mysql_result($result,$i,"cb_company"); $cb_org = mysql_result($result,$i,"cb_org"); $cb_profession = mysql_result($result,$i,"cb_profession");пробуем сервер баз данных на выносливость...
Комментарии (5) -
Java / Говнокод #7650
+64
- 1
- 2
- 3
- 4
boolean i = true; while (i){ out.println("\n"); }Нашлось в недрах работающей программы
Комментарии (8) -
Си / Говнокод #7649
+146
- 1
- 2
- 3
- 4
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) kill_proc(1,SIGTERM,1); #else ...Оригинальный способ проверить версию ядра линукса...
Где-то в сырцах реалтековского драйвера для GPIO...Комментарии (10) -
C++ / Говнокод #7648
+164
- 1
- 2
- 3
FrmCabinetFound *frm = new FrmCabinetFound(index.data(Qt::UserRole).toInt()); ((QMdiArea*)this->parent()->parent()->parent())->addSubWindow(frm); frm->show();Комментарии (4) -
Pascal / Говнокод #7647
+100
- 1
- 2
- 3
- 4
case 0: FilterList.Add('RCHECK = '+''''+'+'+''''); 1: FilterList.Add('RCHECK = '+''''+'-'+''''); ...Автор кода жжот. Код реально работает. Но прочитать такое даже автор по прошествии года не сможет.
Можно было проще
0:FilterList.Add('RCHECK = ''+''');Комментарии (7) -
JavaScript / Говнокод #7646
+147
- 1
var that = this;просто и со вкусом
Комментарии (8) -
Ruby / Говнокод #7645
−104
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
def entities(model, params = {}) @entities ||= {} @entities[model] ||= [] if @entities[model].blank? or parameters_changed?(model, params) @entities[model] = [] include = params[:include] || nil group = params[:group] || nil order = params[:order] || nil page = params[:page] || nil entity_ids = [] model_role = nil model_class = model.to_s.classify.constantize if self.has_role_for?(model_class) self.roles_for(model_class).uniq.each do |role| if role.authorizable_id.blank? raise "Authorization problem! Found more than one #{model_class} model permission!" unless model_role.blank? model_role = role.name next end if !role.authorizable_id.blank? && MerchantRole::MERCHANT_ROLES.include?(role.name) entity_ids << role.authorizable.id end end if entity_ids.blank? and MerchantRole::MERCHANT_ROLES.include?(model_role) #WARNING! RECURSION! EVIL! if MerchantRole.has_entity_parent?(model) parent_model = MerchantRole.entity_parent(model) parent_entities = self.entities(parent_model) unless parent_entities.blank? _params = { :conditions => conditions_and_parameters(params, nil, ["`#{model.to_s}`.`#{parent_model.to_s.singularize}_id` IN (?)", parent_entities.map(&:id)]), :include => include, :order => order, :group => group } _params.merge!(:page => page) if params.keys.include?(:page) if block_given? (self.is_reseller? ? self.reseller.send(model) : model_class).each(_params) do |o| yield o end else @entities[model] = (self.is_reseller? ? self.reseller.send(model) : model_class).send(params.keys.include?(:page) ? :paginate : :find, :all, _params) end end else _params = { :conditions => conditions_and_parameters(params, nil), :include => include, :order => order, :group => group } _params.merge!(:page => page) if params.keys.include?(:page) if block_given? #Find only merchants associated with the reseller or all merchants if we are no reseller. (self.is_reseller? ? self.reseller.send(model) : model_class).each(_params) do |o| yield o end else @entities[model] = (self.is_reseller? ? self.reseller.send(model) : model_class).send(params.keys.include?(:page) ? :paginate : :find, :all, _params) end end else _params = { :conditions => conditions_and_parameters(params, nil, ["`#{model.to_s}`.`id` IN (?)", entity_ids]), :include => include, :order => order, :group => group } _params.merge!(:page => page) if params.keys.include?(:page) if block_given? model_class.each(_params) do |o| yield o end else @entities[model] = model_class.send(params.keys.include?(:page) ? :paginate : :find, :all, _params) end end end end entities[@model] endThis method does the following (you guessed it, right?):
#Fetch entities for which we have a read permission.
#This is now it should work:
#1. : If we don't have any role on the model, we won't get anything.
#2a.: Check roles we have for whole model. If no role for whole model we can only fetch instances we have assigned.
#2b.: Check all instances we have a role for and store them.
#3a.: We have roles for instances -> Goto(#7)
#3b.: We have no instance roles but have a role for the whole model.
#4. : Check recusively if we have roles fro a parent model (channels -> merchants).
#5a.: If we have a parent role and got parent entities returned we only fetch instances belonging to the parent entities.
#6a.: If we have a parent role and got no entities back, then we won't get anything since we are not supposed to.
#7. : Get all instances based on our reseller or globally for the system.Комментарии (6)
Follow us!