A number of them
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 collections import defaultdict | |
class freezable_defaultdict(dict): | |
def __init__(self, default_factory, *args, **kwargs): | |
self.frozen = False | |
self.default_factory = default_factory | |
super(freezable_defaultdict, self).__init__(*args, **kwargs) | |
def __missing__(self, key): |
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
var system = require('system'), | |
env = system.env; | |
/** | |
* Wait until the test condition is true or a timeout occurs. Useful for waiting | |
* on a server response or for a ui change (fadeIn, etc.) to occur. | |
* | |
* @param testFx javascript condition that evaluates to a boolean, | |
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or | |
* as a callback function. |
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
# Fresh repo and some master history | |
git init squash | |
cd squash/ | |
echo one > a | |
git add . | |
git commit -m "First commit" | |
echo two >> a | |
git commit -m "Second commit" | |
git commit -am "Second commit" |
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
Here it goes |
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
import Data.List | |
import Text.Regex | |
import System.Random | |
import Data.Ord | |
type Point = (Float,Float) | |
type Color = (Int,Int,Int) | |
type Polygon = [Point] | |
type Person = [Int] | |
type Link = [Point] |
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
#!/usr/bin/env python | |
# http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html | |
import cv2 | |
import numpy as np | |
from rectangles import Line, line_frequencies, rectangles | |
def lines_to_file(lines): |
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
// This is a workaround for R# complaining on undefined global variables. | |
// In practice they come from and are defined by Jasmine and Protractor | |
// frameworks, so are not a real issues. | |
// Jasmine | |
var describe = function () { }; | |
var beforeEach = function () { }; | |
var afterEach = function () { }; |
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 unittest import TestSuite | |
def print_tests(tests): | |
if isinstance(tests, TestSuite): | |
for child in tests: | |
print_tests(child) | |
else: | |
print tests.id() # package.module.TestClass.test_name |
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 unittest import TestLoader, TextTestRunner | |
def discover_and_run(verbose=False, names=None): | |
# names is None or a list [name, ...] | |
# name is test_suite[.class[.name]] | |
verbosity = 2 if verbose else 1 | |
loader = TestLoader() | |
if names: |
NewerOlder