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
| #include <stdio.h> | |
| /* | |
| * If you pay $4.00 for a latte that costs | |
| * $3.10, how much change do you get? | |
| */ | |
| int main() { | |
| long change = 400 - 310; | |
| printf("change = $%ld.%02ld\n", change/100, change%100); | |
| return 0; |
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
| (1..100).each { num -> | |
| out = ((num % 3) == 0) ? 'Fizz' : '' | |
| if ((num % 5) == 0) out += 'Buzz' | |
| if (out.length() == 0) out = num | |
| println out | |
| } |
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
| 100.times { | |
| displayNum = ++it | |
| def matched = false | |
| if ((displayNum % 3) == 0) { | |
| print "FIZZ" | |
| matched = 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
| // Required jars (I know, I know...I should investigate Grape) | |
| // nekohtml.jar | |
| // xercesimpl.jar | |
| // Define the pages which contain links to products - our "seeds" in crawl parlance. | |
| def seeds = ["http://www.foodnetwork.com/shows/guys-diners-drive-ins-and-dives/index.html"] | |
| // Load the NekoHTML parser with Xerces - this lets us parse the HTML. | |
| slurper = new XmlSlurper(new org.cyberneko.html.parsers.SAXParser()) |
NewerOlder