[code]if true then
A
else
B
end
[/code]
and all of its transliterated forms, brackets or not, is so much easier to follow
[QUOTE=cyber_cam34;40040061]Surely this would make it hard to read and understand when coming back to old code, since you might not notice the following if when scanning the code?[/QUOTE]
I haven't had an issue with it yet. I don't write stupidly long lines of code so it's not something that ever hangs way off to the side out of sight.
Also, syntax highlighting.
Seeing that we all [i]love[/i] PHP: [url]http://www.addedbytes.com/blog/if-php-were-british/[/url]
[QUOTE=Fizzadar;40044429]Seeing that we all [i]love[/i] PHP: [url]http://www.addedbytes.com/blog/if-php-were-british/[/url][/QUOTE]
I actually want that.
[QUOTE=Jelly;40042243]Also, syntax highlighting.[/QUOTE]
Yeah that too haha. I'm of the opinion that the closer my code is to natural english the better. Code is written to be read by people, not machines.
str_to_widget
strtothing
str2caps
str_2_craziness
[QUOTE=Fizzadar;40044429]Seeing that we all [i]love[/i] PHP: [url]http://www.addedbytes.com/blog/if-php-were-british/[/url][/QUOTE]
reminds me of [url]http://spiffingcss.com/[/url]
[QUOTE=cyber_cam34;40040061]Surely this would make it hard to read and understand when coming back to old code, since you might not notice the following if when scanning the code?[/QUOTE]
It's not really hard to read at all after you acknowledge the existence of such type of statements.
The only problem I have myself is reading the conditions specified for until and unless statements because in Italian until is usually followed by a negation (e.g.: the sentence "wait until the cake is ready" in Italian, if translated literally to english would be "wait until the cake isn't ready") so it confuses the fuck out of me when trying to read the conditions because my brain "auto-negates" them.
[QUOTE=Amiga OS;40046078]I wonder if anyone has written a library that normalizes PHP's crazy function names.[/QUOTE]
They call that fork Python I think.
[QUOTE=John the Gr8;40046534]reminds me of [url]http://spiffingcss.com/[/url][/QUOTE]
Awsome, combine for epic win.
Been having fun with javascript made a little sandbox
[url]http://keyo.co/rocket/[/url]
[img]http://tbx.me/4ObjR.png[/img]
Seems to run best on chrome/chromium.
I learned a little bit about how hard my server can take requests today when I had to handle 80k+ hits in just a couple hours, that was fun!
[QUOTE=John the Gr8;40046534]reminds me of [url]http://spiffingcss.com/[/url][/QUOTE]
The music is just the final touch.
Sorry I know this isn't really the appropriate place to ask this, but does any of you guys have a recommended App for android to sync your music to through WiFi? preferably free, but after the countless failed attempts I'm willing to pay.
[QUOTE=BAZ;40056231]Been having fun with javascript made a little sandbox
[url]http://keyo.co/rocket/[/url]
[img]http://tbx.me/4ObjR.png[/img]
Seems to run best on chrome/chromium.[/QUOTE]
Maybe, remove gravity in space?
[QUOTE=BAZ;40056231]Been having fun with javascript made a little sandbox
[url]http://keyo.co/rocket/[/url]
[img]http://tbx.me/4ObjR.png[/img]
Seems to run best on chrome/chromium.[/QUOTE]
Awesome, having lots of fun with this at school. [img]http://www.facepunch.com/fp/ratings/winner.png[/img]
Didn't Google wanted Google Docs, Presentation, Spreadsheet, ..., to become available offline? When?
Building ecommerce for favery.com right now. Doing it quick and simple from scratch so we can test some things out.
[editline]27th March 2013[/editline]
[code]
def total_price
line_items.reduce(0) { |total, line_item| total += line_item.total_price }
end
[/code]
ahh, sweet, beautiful ruby :)
[editline]27th March 2013[/editline]
Not sure what sublime package it is, but I just found out I can press cmd + . while I'm working on tests in an rspec file and be taken to the corresponding ruby file in the rails project... Neat.
Today I changed host, excited. I transfered all my domains etc.
From 500GB storage/5TB bandwidth --> unlimited storage/bandwidth.
Just creating myself a Portfolio, it's my first site so don't be too harsh!
[IMG]http://i.imgur.com/kEmt8gM.jpg[/IMG]
[QUOTE=KmartSqrl;40059407]Building ecommerce for favery.com right now. Doing it quick and simple from scratch so we can test some things out.
[editline]27th March 2013[/editline]
[code]
def total_price
line_items.reduce(0) { |total, line_item| total += line_item.total_price }
end
[/code]
ahh, sweet, beautiful ruby :)
[editline]27th March 2013[/editline]
Not sure what sublime package it is, but I just found out I can press cmd + . while I'm working on tests in an rspec file and be taken to the corresponding ruby file in the rails project... Neat.[/QUOTE]
[code]
line_items.map(&:line_price).inject(0, &:+)
[/code]
or
[code]
line_items.inject(0) { |total, item| total + item.line_price }
[/code]
the return value is set as the total :)
[editline]27th March 2013[/editline]
This only works on ruby 1.9.3 and up, though, i think
[QUOTE=Ac!dL3ak;40061950][code]
line_items.map(&:line_price).inject(0, &:+)
[/code]
or
[code]
line_items.inject(0) { |total, item| total + item.line_price }
[/code]
the return value is set as the total :)
[editline]27th March 2013[/editline]
This only works on ruby 1.9.3 and up, though, i think[/QUOTE]
reduce and inject are the same thing, the second one is the same as what I wrote haha. I dig the map->inject though. I forgot about that one.
[editline]27th March 2013[/editline]
Now it's this:
[code]
def total_price
line_items.map(&:total_price).reduce(:+)
end
[/code]
Since when did this come from show off your work to discuss ruby functions?
Last I checked, posting the code I am writing at work right now is exactly "What are you working on".
[QUOTE=Killervalon;40062665]Since when did this come from show off your work to discuss ruby functions?[/QUOTE]
It's the same as posting PHP snippets, except Ruby is more pleasant.
[QUOTE=KmartSqrl;40062359]reduce and inject are the same thing, the second one is the same as what I wrote haha. I dig the map->inject though. I forgot about that one.
[editline]27th March 2013[/editline]
Now it's this:
[code]
def total_price
line_items.map(&:total_price).reduce(:+)
end
[/code][/QUOTE]
It's slower than just calling #reduce or #inject unless you use a lazy enumerator, which is a ruby 2.0 thing i think
It's only being used to total up items from a shopping cart so the performance gain is negligible in this case.
[editline]27th March 2013[/editline]
Fun fact. I wrote the bulk of a shopping cart system today (still have to do quantity updates and removing items, checkout is separate and coming tomorrow). Fun part of the fact: I didn't have to open my browser window once because TDD is awesome.
Made this through college free periods, I'm happy with it. Shameless YouTube rips on there for exampling shit.
[url]http://nlan.org/video/[/url]
Personally use it for the walking dead stream embedded on it instead of going through bullshit sites.
[QUOTE=KmartSqrl;40063494]It's only being used to total up items from a shopping cart so the performance gain is negligible in this case.
[editline]27th March 2013[/editline]
Fun fact. I wrote the bulk of a shopping cart system today (still have to do quantity updates and removing items, checkout is separate and coming tomorrow). Fun part of the fact: I didn't have to open my browser window once because TDD is awesome.[/QUOTE]
Are there any good resources to learn rails tdd?
Sorry, you need to Log In to post a reply to this thread.