Instantly share code, notes, and snippets.

# Too too

• HXCD
Last active October 4, 2023 09:02
Bowling Game Kata by Python
This file contains 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
 # -*- coding: utf-8 -*- # class Game(object): def __init__(self): self.rolls = [] def roll(self, pins): self.rolls.append(pins)
Last active August 6, 2022 14:56
FizzBuzzWhizz. 解决一道 ThoughtWork 的公开招聘题. 尝试应用了最近学习的敏捷开发+面向对象的概念。

1. 你首先说出三个不同的特殊数，要求必须是个位数，比如3、5、7。
2. 让所有学生拍成一队，然后按顺序报数。
3. 学生报数时，如果所报数字是第一个特殊数（3）的倍数，那么不能说该数字，而要说Fizz；如果所报数字是第二个特殊数（5）的倍数，那么要说Buzz；如果所报数字是第三个特殊数（7）的倍数，那么要说Whizz。
4. 学生报数时，如果所报数字同时是两个特殊数的倍数情况下，也要特殊处理，比如第一个特殊数和第二个特殊数的倍数，那么不能说该数字，而是要说FizzBuzz, 以此类推。如果同时是三个特殊数的倍数，那么要说FizzBuzzWhizz。
5. 学生报数时，如果所报数字包含了第一个特殊数，那么也不能说该数字，而是要说相应的单词，比如本例中第一个特殊数是3，那么要报13的同学应该说Fizz。如果数字中包含了第一个特殊数，那么忽略规则3和规则4，比如要报35的同学只报Fizz，不报BuzzWhizz。
Last active September 4, 2015 09:30

S = [A1, A2, A3 ... A14] A1 = [(1,2), (3,4) ... (13, 14)]

Created February 17, 2014 07:30
quick new tab for input/edit text in Chrome, type in address bar.
This file contains 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
 data:text/html,
Created February 11, 2014 15:02
Here are some things you can do with Gists in GistBox.
This file contains 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
 // Use Gists to store code you would like to remember later on console.log(window); // log the "window" object to the console
Last active August 29, 2015 13:56
direct show template of html file after Django 1.4. From http://stackoverflow.com/questions/15117835/django-1-5-index-page/15117932#15117932
This file contains 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.conf.urls import patterns from django.views.generic import TemplateView urlpatterns = patterns('', (r'^\$', TemplateView.as_view(template_name="index.html")), )