- Plain Strings (207):
foo - Anchors (208):
k$ - Ranges (202):
^[a-f]*$ - Backrefs (201):
(...).*\1 - Abba (169):
^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef - A man, a plan (177):
^(.)[^p].*\1$ - Prime (286):
^(?!(..+)\1+$) - Four (199):
(.)(.\1){3} - Order (198):
^[^o].....?$ - Triples (507):
(^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
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
| #!/usr/bin/env python2.7 | |
| import random | |
| import subprocess | |
| class Node(object): | |
| def __init__(self, key, value): | |
| self.key = key | |
| self.value = value |
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
| # coding: utf-8 | |
| import pygame | |
| import random | |
| rr = random.randrange | |
| SIZE = 800, 600 | |
| cellsize = 20 | |
| try: |
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
| import shutil, tempfile | |
| from os import path | |
| import unittest | |
| class TestExample(unittest.TestCase): | |
| def setUp(self): | |
| # Create a temporary directory | |
| self.test_dir = tempfile.mkdtemp() | |
| def tearDown(self): |
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
| # coding: utf-8 | |
| import pygame | |
| import random | |
| # [email protected] | |
| TAMANHO = (640, 480) | |
| T = 640 / 32 | |
| TX = 640 / T | |
| TY = 480 / T |
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
| class Node : | |
| def __init__( self, data ) : | |
| self.data = data | |
| self.next = None | |
| self.prev = None | |
| class LinkedList : | |
| def __init__( self ) : | |
| self.head = None |
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 datetime import datetime | |
| class LRUCacheItem(object): | |
| """Data structure of items stored in cache""" | |
| def __init__(self, key, item): | |
| self.key = key | |
| self.item = item | |
| self.timestamp = datetime.now() |
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
| """ | |
| this has a lot of list / tuple casting, and doesn't use | |
| native python list properties to full advantage. | |
| It mimics Little Schemer style coding quite well though. | |
| """ | |
| import itertools |
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 bubble(l_elems, is_sorted, step): | |
| if step is 1 or is_sorted: | |
| # base case: l_elems is already sorted or we pass through the list len(l_elems) times | |
| return l_elems | |
| else: | |
| is_swapped = False | |
| for i in range(len(l_elems) - 1): | |
| # compares each pair of adjacent items and swaps them if they are in the wrong order | |
| if l_elems[i] > l_elems[i + 1]: | |
| is_swapped = 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
| # coding: utf-8 | |
| class EmptyClass(object): | |
| def __repr__(self): | |
| return "" | |
| Empty = EmptyClass() | |
| class Node(object): | |
| def __init__(self, value, key=None): |