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
| (defn progress-visualization:c [normal-progress overtime-progress text] | |
| (let [normal-bar [:div.progress-bar.progress-bar-success | |
| (let [base-style {:style {:width (str normal-progress "%")}} | |
| final-style (if overtime-progress | |
| base-style | |
| (assoc base-style :class "progress-bar-striped"))] | |
| final-style) text]] | |
| (if overtime-progress | |
| [normal-bar | |
| [:div.progress-bar.progress-bar-warning.progress-bar-striped |
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
| def add_net_and_tax(discounts): | |
| discounts = map(lambda discount: assoc(discount, 'net', round(discount['gross'] / (1 + tax_rate))), | |
| discounts) | |
| discounts = map(lambda discount: assoc(discount, 'tax', discount['gross'] - discount['net']), | |
| discounts) | |
| return discounts |
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
| #lang racket | |
| (define (fizzbuzz) | |
| (for/list ([n (in-range 1 101)]) | |
| (let ([fizz (zero? (remainder n 3))] | |
| [buzz (zero? (remainder n 5))]) | |
| (cond [(and fizz buzz) "FizzBuzz"] | |
| [fizz "Fizz"] | |
| [buzz "Buzz"] | |
| [else (number->string n)])))) |
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
| from django.test.testcases import SimpleTestCase | |
| class A(SimpleTestCase): | |
| def f(self): | |
| self.assertInHTML('a', '<span>a</span>') | |
| def runTest(self): | |
| pass | |
| a = A() |
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
| CronJob = require('cron').CronJob | |
| new CronJob('* * * * * *', () -> | |
| console.log "tick" | |
| return | |
| , null, true, "Europe/Berlin") | |
| module.exports = (robot) -> | |
| tz = 'Europe/Berlin' | |
| new CronJob('* * * * * *', testBuild, null, true, tz) |
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
| #lang racket | |
| (define hangul-data-file "src/racket-unihan/Unihan_Readings.txt") | |
| (define (port-filter predicate) | |
| (define next-line | |
| (lambda (in) | |
| (define l (read-line in)) | |
| (if (or (eof-object? l) | |
| (predicate l)) |
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
| set_of_lines = SetOfLines([]) | |
| stock_info = basket.strategy.fetch_for_product(product) | |
| new_line_ref = object() | |
| set_of_lines.add_line(Line(new_line_ref, product, stock_info.stockrecord, 1, | |
| stock_info.price.incl_tax)) | |
| applicator = Applicator() | |
| offers = applicator.get_offers(request, basket) | |
| applicator.apply_offers(set_of_lines, offers, request.user) |
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
| /* | |
| * cc -o main main.c -lreadline | |
| */ | |
| #include "readline/readline.h" | |
| int main(int argc, const char* argv) | |
| { | |
| char *line; | |
| while (1) { |
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
| @classmethod | |
| def setUpClass(cls): | |
| if not hasattr(cls, 'domain'): | |
| return | |
| if not cls.extra_environ: | |
| cls.extra_environ = {} | |
| cls.extra_environ.update(HTTP_HOST=cls.domain.encode('ascii')) |
NewerOlder