some of these patterns are taken from SmartyPants...
348614
def convert_string(item)
      CGI.escapeHTML(item).
      
      
      # convert -- to em-dash, (-- to en-dash)
        gsub(/---?/, '&#8212;'). #gsub(/--/, '&#8211;').

      # convert ... to elipsis (and make sure .... becomes .<elipsis>)
        gsub(/\.\.\.\./, '.&#8230;').gsub(/\.\.\./, '&#8230;').

      # convert single closing quote
        gsub(%r{([^ \t\r\n\[\{\(])\'}) { "#$1&#8217;" }.
        gsub(%r{\'(?=\W|s\b)}) { "&#8217;" }.

      # convert single opening quote
        gsub(/'/, '&#8216;').

      # convert double closing quote
        gsub(%r{([^ \t\r\n\[\{\(])\'(?=\W)}) { "#$1&#8221;" }.

      # convert double opening quote
        gsub(/'/, '&#8220;').

      # convert copyright
        gsub(/\(c\)/, '&#169;').

      # convert and registered trademark
        gsub(/\(r\)/, '&#174;')

    end
267639
function walkCollections(patterns, drizzleData, writePromises = []) {
  if (hasCollection(patterns)) {
    writePromises.push(
      writePage(
        patterns.collection.id,
        patterns.collection,
        drizzleData.options.dest.patterns,
        drizzleData.options.keys.collections.plural
      )
    );
  }
  for (const patternKey in patterns) {
    if (!isCollection(patterns[patternKey])) {
      walkCollections(patterns[patternKey], drizzleData, writePromises);
    }
  }
  return writePromises;
}
1350223
def _symmetrize_correlograms(correlograms):
    """"""

    n_clusters, _, n_bins = correlograms.shape
    assert n_clusters == _

    # We symmetrize c[i, j, 0].
    # This is necessary because the algorithm in correlograms()
    # is sensitive to the order of identical spikes.
    correlograms[..., 0] = np.maximum(correlograms[..., 0],
                                      correlograms[..., 0].T)

    sym = correlograms[..., 1:][..., ::-1]
    sym = np.transpose(sym, (1, 0, 2))

    return np.dstack((sym, correlograms))
284195
def MakeProbs(self):
        """"""
        for hypo, odds in self.Items():
            self.Set(hypo, Probability(odds))
250740
public boolean suspicious(Context context) {
        for(ProcPattern pattern:patterns){
            if(pattern.suspicious(context)){
                return true;
            }
        }
        return false;
    }
966957
def prettyMatcherList(things):
    """"""
    norm = []
    for x in makeSequence(things):
        if hasattr(x, 'pattern'):
            norm.append(x.pattern)
        else:
            norm.append(x)
    return "('%s')" % "', '".join(norm)
509477
def _make_patterns(patterns):
    
    field_registry = display_fields.FieldRegistry()

    pattern_list = display_pattern.ScreenPatternList(
        field_registry=field_registry,
    )
    for pattern in patterns:
        pattern_list.add(pattern.split('\n'))
    return pattern_list
757194
static void detectAdjacentAndPositionPatterns(int N, QrCodeCodeWordLocations matrix, FoundFeatures features) {

		for (int foo = 0; foo < 2; foo++) {
			for (int row = 0; row < N; row++) {
				int index = row * N;
				for (int col = 1; col < N; col++, index++) {
					if (matrix.data[index] == matrix.data[index + 1])
						features.adjacent++;
				}
				index = row * N;
				for (int col = 6; col < N; col++, index++) {
					if (matrix.data[index] && !matrix.data[index + 1] &&
							matrix.data[index + 2] && matrix.data[index + 3] && matrix.data[index + 4] &&
							!matrix.data[index + 5] && matrix.data[index + 6])
						features.position++;
				}
			}
			CommonOps_BDRM.transposeSquare(matrix);
		}

		// subtract out false positives by the mask applied to position patterns, timing, mode
		features.adjacent -= 8*9 + 2*9*8 + (N-18)*2;
	}
542163
def GetPatternIdTripDict(self):
    """"""
    d = {}
    for t in self._trips:
      d.setdefault(t.pattern_id, []).append(t)
    return d
1136368
def generate_pattern_list(self):
        
        patterns = {}
        items = self.frequent.keys()

        # If we are in a conditional tree,
        # the suffix is a pattern on its own.
        if self.root.value is None:
            suffix_value = []
        else:
            suffix_value = [self.root.value]
            patterns[tuple(suffix_value)] = self.root.count

        for i in range(1, len(items) + 1):
            for subset in itertools.combinations(items, i):
                pattern = tuple(sorted(list(subset) + suffix_value))
                patterns[pattern] = \
                    min([self.frequent[x] for x in subset])

        return patterns
1026636
private void addAntiPatternExamples() {
		add(new WHeading(HeadingLevel.H2, "WButton anti-pattern examples"));
		add(new WMessageBox(WMessageBox.WARN,
				"These examples are purposely bad and should not be used as samples of how to use WComponents but samples of how NOT to use them."));

		add(new WHeading(HeadingLevel.H3, "WButton without a good label"));
		add(new WButton("\u2002"));
		add(new ExplanatoryText("A button without a text label is very bad"));

		add(new WHeading(HeadingLevel.H3, "WButton with a WImage but without a good label"));
		WButton button = new WButton("");
		button.setImage("/image/help.png");
		add(button);
		add(new ExplanatoryText(
				"A button without a text label is very bad, even if you think the image is sufficient. The text label becomes the image alt text."));

	}
568034
public void findPatterns(GrayF32 input) {
		found.reset();
		detector.process(input);
		clusterFinder.process(detector.getCorners().toList());
		FastQueue<ChessboardCornerGraph> clusters = clusterFinder.getOutputClusters();

		for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {
			ChessboardCornerGraph c = clusters.get(clusterIdx);

			if (!clusterToGrid.convert(c, found.grow())) {
				found.removeTail();
			}
		}
	}
412705
private static boolean resemblesPropertyPattern(String pattern, int pos) {
        // Patterns are at least 5 characters long
        if ((pos+5) > pattern.length()) {
            return false;
        }

        // Look for an opening [:, [:^, \p, or \P
        return pattern.regionMatches(pos, "[:", 0, 2) ||
                pattern.regionMatches(true, pos, "\\p", 0, 2) ||
                pattern.regionMatches(pos, "\\N", 0, 2);
    }
789249
def pattern_filter(items, whitelist=None, blacklist=None, key=None):
    
    key = key or __return_self
    if whitelist:
        whitelisted = _filter(items, whitelist, key)

        if blacklist:
            blacklisted = _filter(items, blacklist, key)
            # Remove any blacklisted items from the whitelisted ones.
            whitelisted.difference_update(blacklisted)

        return [item for item in items if key(item) in whitelisted]

    elif blacklist:
        blacklisted = _filter(items, blacklist, key)
        return [item for item in items if key(item) not in blacklisted]

    else:
        return items
993722
public List<Pattern52> getPatterns() {
        final List<Pattern52> patterns = new ArrayList<Pattern52>();
        for (CompositeColumn<?> cc : conditionPatterns) {
            if (cc instanceof Pattern52) {
                patterns.add((Pattern52) cc);
            }
        }
        return Collections.unmodifiableList(patterns);
    }
1048696
protected void initializePatterns()
    {
        this.contentPagePatterns = initializationPagePatterns(this.contentPages);
        this.technicalPagePatterns = initializationPagePatterns(this.technicalPages);

        // Transform title expectations into Patterns
        Map<Pattern, Pattern> patterns = new HashMap<>();
        for (String key : this.titles.stringPropertyNames()) {
            patterns.put(Pattern.compile(key), Pattern.compile(this.titles.getProperty(key)));
        }
        this.titlePatterns = patterns;
    }
1136189
function(){
        while(this.numPairs>0){
            var pair=this.pairs[--this.numPairs];
            pair.shape1=null;
            pair.shape2=null;
        }
        this.numPairChecks=0;
        this.collectPairs();
    }