• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 22:34
CET 04:34
KST 12:34
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners4Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
Starcraft, SC2, HoTS, WC3, returning to Blizzcon!21$5,000+ WardiTV 2025 Championship5[BSL21] RO32 Group Stage3Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win9
StarCraft 2
General
TL.net Map Contest #21: Winners Starcraft, SC2, HoTS, WC3, returning to Blizzcon! RotterdaM "Serral is the GOAT, and it's not close" Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win 5.0.15 Patch Balance Hotfix (2025-10-8)
Tourneys
Constellation Cup - Main Event - Stellar Fest $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond) $3,500 WardiTV Korean Royale S4
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection Mutation # 495 Rest In Peace
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ SnOw's ASL S20 Finals Review [BSL21] RO32 Group Stage Practice Partners (Official) [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[Megathread] Daily Proleagues [BSL21] RO32 Group B - Sunday 21:00 CET [BSL21] RO32 Group A - Saturday 21:00 CET BSL21 Open Qualifiers Week & CONFIRM PARTICIPATION
Strategy
PvZ map balance Current Meta How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread ZeroSpace Megathread General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Dating: How's your luck?
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Why we need SC3
Hildegard
Career Paths and Skills for …
TrAiDoS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1608 users

#TODO: Find suitable ransom to nego new end points

Blogs > Chef
Post a Reply
1 2 Next All
Chef
Profile Blog Joined August 2005
10810 Posts
Last Edited: 2015-11-24 01:33:55
November 22 2015 23:04 GMT
#1

## blogjwa.rb

require_relative '../secrets.rb'
require 'shitpost'
require 'net/https'
require 'uri'
require 'json'

USER = 'Chef'
PASS = TL_PASS
TL_POST_URL = 'https://www.teamliquid.net'
TL_POST_PATH = '/post'

def deliver_garbage(content)

uri = URI.parse(TL_POST_URL)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
data = "content=#{content}&user=#{USER}&pass=#{PASS}"
headers = {'Content-Type'=> 'application/x-www-form-urlencoded'}
JSON.parse http.post(TL_POST_PATH, data, headers)
end

content = ShitPost.generate('poop')

puts deliver_garbage(content).inspect

## blogjudge.rb

require 'nokogiri'
require_relative '../list_of_users_i_like.rb'

XML_DOC_URL = 'http://www.teamliquid.net/GetLatestUserBlogReplies?User=Chef'

def silently_judge_replies(replies)

def judgement(name)
ARRAY_OF_USERS_I_LIKE.include?(name) ? 5 : (1 + rand(5))
end

judgements = {}

replies.each_with_index do |r, i|
judgements[r['name']] ||= []
judgements[r['name']] << { i => judgement(r['name']) }
end

judgements
end

def return_replies_hash
doc = Nokogiri::XML(open(XML_DOC_URL))
Hash.from_xml(doc.xpath('//replies').to_s)
end

replies = return_replies_hash
judgements = silently_judge_replies(replies)

puts judgements.inspect

## crontab

0 0 * * 0 /usr/local/rvm/gems/ruby-2.0.0-p353@tl/wrappers/ruby /home/dev/tl/scripts/blogjwa.rb > /home/dev/cron-debug.txt 2>&1
0 * * * * /usr/local/rvm/gems/ruby-2.0.0-p353@tl/wrappers/ruby /home/dev/tl/scripts/blogjudge.rb > /home/dev/cron-debug.txt 2>&1


***
LEGEND!! LEGEND!!
Zealously
Profile Blog Joined October 2011
East Gorteau22261 Posts
Last Edited: 2015-11-22 23:56:11
November 22 2015 23:55 GMT
#2
I don't know what this is so I will do the very internet thing, assume it's clever/funny and 5/5
AdministratorBreak the chains
LightTemplar
Profile Blog Joined August 2011
Ireland481 Posts
November 23 2015 00:13 GMT
#3
Consider your assumption silently judged then.
"Thoughts are always there, the mind can't stop" - Grubby
Zealously
Profile Blog Joined October 2011
East Gorteau22261 Posts
November 23 2015 00:22 GMT
#4
On November 23 2015 09:13 LightTemplar wrote:
Consider your assumption silently judged then.


It's ok I'm a writer all I do is have my thoughts judged anyway
AdministratorBreak the chains
Ilikestarcraft
Profile Blog Joined November 2004
Korea (South)17731 Posts
November 23 2015 00:41 GMT
#5
This is what happens to an English major who becomes a programmer
"Nana is a goddess. Or at very least, Nana is my goddess." - KazeHydra
Chef
Profile Blog Joined August 2005
10810 Posts
November 23 2015 01:04 GMT
#6
The real horror is that I've edited this 3 times realising there are bugs in my fake code.

2.1.3 :005 > ary = ['Zealously', 'LightTemplar', 'Zealously', 'Ilikestarcraft']
=> ["Zealously", "LightTemplar", "Zealously", "Ilikestarcraft"]
2.1.3 :006 > def judgement(ary); ary.each {|n| puts "#{n} #{(1 + rand(5))}" } end
=> :judgement
2.1.3 :007 > judgement ary
Zealously 4
LightTemplar 4
Zealously 3
Ilikestarcraft 2

Harsh. Luckily the real program accounts for ils and makes him a 5
LEGEND!! LEGEND!!
iSometric
Profile Blog Joined February 2011
2221 Posts
November 23 2015 02:23 GMT
#7
System.out.println("5/5")
strava.com/athletes/zhaodynasty
patrick321
Profile Joined August 2004
United States185 Posts
November 23 2015 03:04 GMT
#8
stars ||= 5

This made me stop for a couple minutes and see if i could break it.
c3rberUs
Profile Blog Joined December 2010
Japan11286 Posts
November 23 2015 05:56 GMT
#9
comments = [ 'This is Ruby right? First time seeing Ruby code', 'The syntax looks close to Python', 'Anyway 5/5 until I can actually read Ruby']

for comment in comments:
printf comment
WriterMovie, 진영화 : "StarCraft will never die".
mantequilla
Profile Blog Joined June 2012
Turkey779 Posts
November 23 2015 09:11 GMT
#10
Sure it will throw a nullpointerexception.
Age of Mythology forever!
boxerfred
Profile Blog Joined December 2012
Germany8360 Posts
November 23 2015 12:20 GMT
#11
public void learnRuby(){
// todo
}
YourGoodFriend
Profile Blog Joined June 2010
United States2197 Posts
November 23 2015 14:46 GMT
#12
Is your handle in reference to Chef?

Also obligatory ewww ruby {{My language}} is so much better.
anonymous is the most famous author that anyone can be
amazingxkcd
Profile Blog Joined September 2010
GRAND OLD AMERICA16375 Posts
November 23 2015 15:23 GMT
#13
why are you requiring nokogiri ? should only need the "passion" directive
The world is burning and you rather be on this terrible website discussing video games and your shallow feelings
Danglars
Profile Blog Joined August 2010
United States12133 Posts
November 23 2015 21:57 GMT
#14
Haha the silent judge and people I like bits. haha
Great armies come from happy zealots, and happy zealots come from California!
TL+ Member
Fecalfeast
Profile Joined January 2010
Canada11355 Posts
November 23 2015 23:33 GMT
#15
##Feast.rb

require 'shitpost'

def chew()
# Find something to eat
food = ShitPost.generate('poop')
# Break food down into an array of separate words spitting out any punctuation or spaces
food.split(/\W+/).map(&:to_s)
swallow(food)
end

def swallow(food)
stomach = []
churn = false
#digest words into letters
for chunks in food
if churn == false
churn = true
else
churn = false
chunks.split(//)
# jumble letters into stomach array
for mush in chunks
if churn == true
stomach.unshift(mush)
else
stomach << mush
end
end
vomit(stomach)
end

def vomit(stomach)
#regurgitate contents of stomach until empty
for bile in stomach
puts bile
end
puts "I feel much better now"
end

chew()


I only really know python so I googled a lot of things for this but unless I misunderstand what the module shitpost does I think this would work
ModeratorINFLATE YOUR POST COUNT; PLAY TL MAFIA
Chef
Profile Blog Joined August 2005
10810 Posts
Last Edited: 2015-11-24 01:34:52
November 24 2015 01:28 GMT
#16
I think the chew method can be improved by not including the swallow call. What happens when you want to write code where the shit post is immediately regurgitated to feed your young? Also the swallow method is not in scope, so it won't work. Chew should really take the argument food, not generate the food.

As a personal preference, I dislike comments which are not explaining an unusual piece of code that would make another programmer wonder why you did it a specific way. The method containing the code should generally be enough to tell you what it does.
LEGEND!! LEGEND!!
Fecalfeast
Profile Joined January 2010
Canada11355 Posts
November 24 2015 02:15 GMT
#17
I was writing the comments to explain to me what I wanted to program to do. I lack organization and writing things down before I can articulate them in code keeps me on track.

What does 'in scope' mean? I'm fairly green at programming and just make tools that I can't find with a simple google search.

Are you saying it would be better to have a separate method for finding food, then feed that variable through chew's parameter brackets?
ModeratorINFLATE YOUR POST COUNT; PLAY TL MAFIA
patrick321
Profile Joined August 2004
United States185 Posts
November 24 2015 02:36 GMT
#18
The OP's post was clever but fecalfeast's was art. The form perfectly embellished the content. And his topical name was the cherry on top of the cow pie.

Critiquing his code here is like stopping a singer to correct his lyrics.
Chef
Profile Blog Joined August 2005
10810 Posts
November 24 2015 14:31 GMT
#19
On November 24 2015 11:15 Fecalfeast wrote:
I was writing the comments to explain to me what I wanted to program to do. I lack organization and writing things down before I can articulate them in code keeps me on track.

What does 'in scope' mean? I'm fairly green at programming and just make tools that I can't find with a simple google search.

Are you saying it would be better to have a separate method for finding food, then feed that variable through chew's parameter brackets?

Sure, it's not problem. I like to write methods I wish existed when thinking about the top level logic of my code, and then write the methods.

My bad about the scope, your methods are all in the global scope so they are accessible to one another.

ex

2.1.3 :001 > def bear; puts 'bear'; end
=> :bear
2.1.3 :002 > def kuma; puts bear; end
=> :kuma
2.1.3 :003 > kuma
bear

In larger applications, you have to throw things into classes and modules, so that you can avoid naming collisions by polluting the global scope (you can google javascript global scope for a typical explanation).

If for example you had defined method A within method B, you wouldn't be able to access method A outside method B. Similarly, if you define methods within a class, you can access them anywhere within the class, but outside the class you have to call Class.method (or if you have an instance of the class, instance.method).

I'm just saying your method chew does not describe accurately enough what it does, which is find food and digest it and vomit it out. So when someone calls chew they will get the unexpected result of vomit. Really your method would be accurately called find_food_eat_it_and_vomit_it_out which is a method that seems to have a lot of responsibilities. If I wrote such a method, it would have calls to three other methods, find_food eat_food (which has chew_food and swallow_food methods) vomit_food. This way the code is more reusable, the stack trace will be easier to read, and if you need to update one of them, all your methods that use them will be updates simultaneously, instead of you having to update the same code in multiple places.

Even if all you use code for is one off scripts for yourself, it might help you to build a library of methods you often need to use (which you could do a very simple require to have accessible in all your scripts, saving you some copy / pasting). Naming those methods logically will help you to remember without referencing them.
LEGEND!! LEGEND!!
endy
Profile Blog Joined May 2009
Switzerland8970 Posts
November 24 2015 23:20 GMT
#20
After a hard day at work, coding, I open at TL, then "yes a Chef blog"... meh
...

Chef, how about an "Allow me to analyze your code writing" ;-)



ॐ
1 2 Next All
Please log in or register to reply.
Live Events Refresh
Replay Cast
23:00
WardiTV Mondays #58
LiquipediaDiscussion
OSC
22:00
Masters Cup 150 Open Qual
Liquipedia
LAN Event
18:00
Day 3: Ursa 2v2, FFA
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 185
NeuroSwarm 144
ProTech125
StarCraft: Brood War
Calm 8081
Shuttle 690
Artosis 639
Sharp 422
actioN 422
Noble 93
Icarus 8
Dota 2
LuMiX1
Other Games
tarik_tv11761
summit1g9994
JimRising 447
WinterStarcraft274
C9.Mang0223
ViBE171
FrodaN126
Organizations
Other Games
gamesdonequick767
Counter-Strike
PGL143
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Sammyuel 12
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota21525
League of Legends
• Stunt312
Other Games
• Scarra543
Upcoming Events
OSC
8h 26m
LAN Event
11h 26m
Korean StarCraft League
23h 26m
CranKy Ducklings
1d 6h
LAN Event
1d 11h
IPSL
1d 14h
dxtr13 vs OldBoy
Napoleon vs Doodle
BSL 21
1d 16h
Gosudark vs Kyrie
Gypsy vs Sterling
UltrA vs Radley
Dandy vs Ptak
Replay Cast
1d 19h
Sparkling Tuna Cup
2 days
WardiTV Korean Royale
2 days
[ Show More ]
LAN Event
2 days
IPSL
2 days
JDConan vs WIZARD
WolFix vs Cross
BSL 21
2 days
spx vs rasowy
HBO vs KameZerg
Cross vs Razz
dxtr13 vs ZZZero
Replay Cast
3 days
Wardi Open
3 days
WardiTV Korean Royale
4 days
Replay Cast
5 days
Kung Fu Cup
5 days
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
5 days
The PondCast
6 days
RSL Revival
6 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
6 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

BSL 21 Points
SC4ALL: StarCraft II
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
Stellar Fest: Constellation Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

BSL Season 21
SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.