Instantly share code, notes, and snippets.

# Nikki DelRossoNikkiDelRosso

• Sort options
Created Mar 9, 2017
Measure WPM on free-form text
View wpm.py
 import time def main(): print "Starting test now: begin typing free-form text." print "Press enter to send. Send an empty message to exit." avg = 0 tests = 0 try: avg = wpm_test()
Last active Dec 25, 2015
Calculate the maximum consecutive sum in a sequence of numbers, keeping track of the range producing the max. Fork of https://gist.github.com/Nikker/6926596
View max_consecutive_sum_idx.py
 # Finds the maximum consecutive sum in a list of numbers. # Returns a three-value tuple containing: # 0: Starting index of the max sum # 1: Ending index of the max sum # 2: The maximum sum def max_consecutive_sum_idx(values): if not values: return None maxval = None
Last active Dec 25, 2015
Calculate the maximum consecutive sum in a sequence of numbers
View max_consecutive_sum.py
 # Return the maximum consecutive sum in a list of numbers def max_consecutive_sum(values): m = None prev = None for value in values: cur = value + max(prev, 0) m = max(cur, m) prev = cur return m
Last active Aug 29, 2015
Function to detect and strip UTF-8 BOM from a string in ASP/VBScript
View strip_BOM.asp
 <% Function stripBOM(ByVal content) stripBOM = content If Len(content) > 2 Then If AscW(Mid(content, 1, 1)) = &HEF AND _ AscW(Mid(content, 2, 1)) = &HBB AND _ AscW(Mid(content, 3, 1)) = &HBF _ Then stripBOM = Mid(content, 4)
You can’t perform that action at this time.