Last active
December 11, 2015 01:59
-
-
Save jonahoffline/4527823 to your computer and use it in GitHub Desktop.
Revisions
-
jonahoffline revised this gist
Mar 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -103,4 +103,4 @@ else "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end m.reply reason_msg -
jonahoffline revised this gist
Mar 24, 2013 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -91,4 +91,16 @@ else "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end m.reply reason_msg #Refactor #5 (March 24th) # This little bitch had a nasty bug. Paranthesis needed to close after 'to_i' method reason_msg = if (count = @offenders.fetch(nick).to_i) >= 5 m.channel.kick(nick, "Get the fuck out bitch!") "Goddamn fool had it coming. I warned him #{count} times" else "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end m.reply reason_msg -
jonahoffline revised this gist
Jan 14, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ # Less code is always a plus but there's something wrong with that else return. # It looks lonely and ugly; just like the girl that nobody wants to fuck. result = if @offenders.has_key?(nick) @offenders.fetch(nick).next else 1 @@ -40,7 +40,7 @@ # So, anybody resistin' can goddamn my ass kissin! # Dear Ternary, you ain't tender anymore so get the fuck off my code. new_count = @offenders.has_key?(nick) ? @offenders.fetch(nick).next : 1 @offenders.store(nick, new_count) m.reply "#{nick} arranca, pal carajo a otro canal a hablar de esa mierda mamabicho." @@ -57,7 +57,7 @@ #Refactor #3 # Drier than a nun. This bitch is flowin' straight from the survival scrolls! # Removed the has_key? method and replaced it with some fly, pimped-ass code inspired by the power of the Holy Ghost. # By who power? The || operator motherfucker. # Meet the control flow hitman. Got any shady method returning nil? Child-threads gone wild? Promiscuous instance variables? # Hire this mac-daddy; it will put a cap on nil's ass and provide you with the goods. -
jonahoffline revised this gist
Jan 14, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -85,7 +85,7 @@ # Coding is not a competition, it's all about cooperation of humans and machines. Stupid-ass bitch! # So we got rid of the each method, and what's the result? code runs faster than a nigerian chicken! reason_msg = if (count = @offenders.fetch(nick).to_i >= 5) m.channel.kick(nick, "Get the fuck out bitch!") "Goddamn fool had it coming. I warned him #{count} times" else -
jonahoffline revised this gist
Jan 14, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -68,7 +68,7 @@ # While you may not agree with this change (and just to let you know: I don't give a fuck) # Your thoughts ain't my thoughts so gem install hatorade to your wetware (the brain...) # Alright now, let's stay focused, let's stay dry. Scroll down because this shit is about to go down. @offenders.each do |_, count| reason_msg = if (count >= 5) -
jonahoffline revised this gist
Jan 14, 2013 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,6 @@ end #Refactor #1 # Less code is always a plus but there's something wrong with that else return. # It looks lonely and ugly; just like the girl that nobody wants to fuck. @@ -36,7 +35,6 @@ m.reply "#{nick} arranca, pal carajo a otro canal a hablar de esa mierda mamabicho." #Refactor #2 # I could live with this version but this could read better and not kill my code boner. # So, anybody resistin' can goddamn my ass kissin! @@ -55,10 +53,9 @@ m.reply "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end end #Refactor #3 # Drier than a nun. This bitch is flowin' straight from the survival scrolls! # Removed the key? method and replaced it with some fly, pimped-ass code inspired by the power of the Holy Ghost. # By who power? The || operator motherfucker. @@ -83,6 +80,7 @@ m.reply reason_msg end #Refactor #4 # Coding is not a competition, it's all about cooperation of humans and machines. Stupid-ass bitch! # So we got rid of the each method, and what's the result? code runs faster than a nigerian chicken! -
jonahoffline revised this gist
Jan 14, 2013 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -71,7 +71,7 @@ # While you may not agree with this change (and just to let you know: I don't give a fuck) # Your thoughts ain't my thoughts so gem install hatorade to your wetware (the brain...) # Alright now, let's stay focused, let's stay dry. Scroll down this shit is about to go down. @offenders.each do |_, count| reason_msg = if (count >= 5) @@ -83,4 +83,14 @@ m.reply reason_msg end #Refactor #4 # Coding is not a competition, it's all about cooperation of humans and machines. Stupid-ass bitch! # So we got rid of the each method, and what's the result? code runs faster than a nigerian chicken! reason_msg = if (@offenders.fetch(nick).to_i >= 5) m.channel.kick(nick, "Get the fuck out bitch!") "Goddamn fool had it coming. I warned him #{count} times" else "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end m.reply reason_msg -
jonahoffline revised this gist
Jan 14, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ m.channel.kick(m.user.nick, "Get the fuck out bitch!") m.reply "Goddamn fool had it coming. I warned him #{count} times" else m.reply "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end end @@ -52,7 +52,7 @@ m.channel.kick(m.user.nick, "Get the fuck out bitch!") m.reply "Goddamn fool had it coming. I warned him #{count} times" else m.reply "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end end @@ -78,7 +78,7 @@ m.channel.kick(nick, "Get the fuck out bitch!") "Goddamn fool had it coming. I warned him #{count} times" else "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wrath bitch.)" end m.reply reason_msg end -
jonahoffline created this gist
Jan 14, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,86 @@ #Original # If you were down with this you are a code martyr waiting for a stab. # Ruby was born so that code could be drier than your Grandma. # The first any? method is as useless as a PHP Senior Developer so I ain't worried! # The @offenders hash always get saved using the store method so cut that bitch off! if @offenders.any? && @offenders.key?(nick) @offenders.store(nick, @offenders.fetch(nick).next) else @offenders.store(nick, 1) m.reply "#{nick} arranca, pal carajo a otro canal a hablar de esa mierda mamabicho." end @offenders.each do |_, count| if count >= 5 m.channel.kick(m.user.nick, "Get the fuck out bitch!") m.reply "Goddamn fool had it coming. I warned him #{count} times" else m.reply "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wratch bitch.)" end end #Refactor #1 # Less code is always a plus but there's something wrong with that else return. # It looks lonely and ugly; just like the girl that nobody wants to fuck. result = if @offenders.key?(nick) @offenders.fetch(nick).next else 1 end @offenders.store(nick, result) m.reply "#{nick} arranca, pal carajo a otro canal a hablar de esa mierda mamabicho." #Refactor #2 # I could live with this version but this could read better and not kill my code boner. # So, anybody resistin' can goddamn my ass kissin! # Dear Ternary, you ain't tender anymore so get the fuck off my code. new_count = @offenders.key?(nick) ? @offenders.fetch(nick).next : 1 @offenders.store(nick, new_count) m.reply "#{nick} arranca, pal carajo a otro canal a hablar de esa mierda mamabicho." # We'll also take care of this little clusterfuck that followed (in the original version): @offenders.each do |_, count| if count >= 5 m.channel.kick(m.user.nick, "Get the fuck out bitch!") m.reply "Goddamn fool had it coming. I warned him #{count} times" else m.reply "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wratch bitch.)" end end #Refactor #3 # Drier than a nun. This bitch is flowin' straight from the survival scrolls! # Removed the key? method and replaced it with some fly, pimped-ass code inspired by the power of the Holy Ghost. # By who power? The || operator motherfucker. # Meet the control flow hitman. Got any shady method returning nil? Child-threads gone wild? Promiscuous instance variables? # Hire this mac-daddy; it will put a cap on nil's ass and provide you with the goods. new_count = @offenders.fetch(nick).next || 1 @offenders.store(nick, new_count) m.reply "#{nick} arranca, pal carajo a otro canal a hablar de esa mierda mamabicho." # While you may not agree with this change (and just to let you know: I don't give a fuck) # Your thoughts ain't my thoughts so gem install hatorade to your wetware (the brain...) # Alright now, let's stay focused, let's stay dry. @offenders.each do |_, count| reason_msg = if (count >= 5) m.channel.kick(nick, "Get the fuck out bitch!") "Goddamn fool had it coming. I warned him #{count} times" else "Warning: ##{count}. (Just #{5 - count} more and you'll feel my wratch bitch.)" end m.reply reason_msg end