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
class Participle: | |
def __init__(self, ending): | |
self.vowels = ['a', 'e', 'i', 'o', 'u'] | |
self.doublingConsonants = ['b', 'd', 'g', 'k', 'l', 'm', 'n', | |
'p', 'r', 't', 'v', 'z'] | |
self.vvgExceptions = { | |
'abhor': 'abhorring', | |
'aver': 'averring', | |
'ballot': 'balloting', |
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
python -m cProfile c45.py b.txt T > profile.txt |
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
static public string RemoveBadFileNameChars(this string strFileName) | |
{ | |
char[] badPath = Path.GetInvalidPathChars(); | |
char[] badFile = { '\\', '/', ':', '*', '?', '\"', '<', '>', '|', '' }; | |
foreach (char c in badPath) | |
strFileName = strFileName.Replace(c, '_'); | |
foreach (char c in badFile) | |
strFileName = strFileName.Replace(c, '_'); | |
strFileName = strFileName.Replace("\0", ""); |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.Composition; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using Eastwind.Entities; | |
using Esoteric; | |
using Esoteric.DAL.Interfaces; |
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 bisect | |
class NFA(object): | |
EPSILON = object() | |
ANY = object() | |
def __init__(self, start_state): | |
self.transitions = {} | |
self.final_states = set() | |
self._start_state = start_state |
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
puts {obect}.inspect | |
binding.pry |
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
def similar_songs(): | |
import csv | |
vector = ['acousticness', 'danceability', 'energy', | |
'instrumentalness', 'liveness', 'speechiness', | |
'valence'] # minus 'bpm & 'key' | |
underworld = 'underworld.txt' | |
mbm = 'mbm.txt' | |
orbital = 'orbital.txt' |
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
def genGrayCode(n): | |
if n == 1: | |
return ['0', '1'] | |
else: | |
lastCode = genGrayCode(n - 1) | |
rLastCode = lastCode[:] | |
rLastCode.reverse() | |
lastCode = ['0' + x for x in lastCode] | |
rLastCode = ['1' + x for x in rLastCode] | |
return lastCode + rLastCode |
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 sys, traceback | |
try: | |
i = 1 / 0 | |
except Exception: | |
for fncall in traceback.format_exception(*sys.exc_info()): | |
print(fncall) |
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
for(var p in scope) | |
{ | |
if(typeof scope[p] !== "function") { | |
console.log(p); | |
} | |
} |
OlderNewer