Skip to content

Instantly share code, notes, and snippets.

View maxstudener's full-sized avatar

Maxmillian Studener maxstudener

View GitHub Profile
var fs = require('fs');
var itertools = require("itertools");
var words = new Object();
var real_words = new Object();
fs.readFile('/usr/share/dict/words', function(err, data) {
var infile = data.toString().toLowerCase().split("\n");
for(i = infile.length -1;i>=0;i--) {
words[infile[i]] = true;
@maxstudener
maxstudener / words.pl
Created October 29, 2013 22:29
Word Combinations
use Algorithm::Permute;
my %words = ();
my %real_words = ();
open(MYFILE,"/usr/share/dict/words");
while (<MYFILE>) {
chomp;
$words{lc($_)} = undef;
}
close(MYFILE);
@maxstudener
maxstudener / words.php
Created October 29, 2013 22:29
Word Combinations
<?php
ini_set('memory_limit', '-1');
function permutation($arr, $temp_string, &$collect) {
if ($temp_string != "")
$collect []= $temp_string;
for ($i=0; $i<sizeof($arr);$i++) {
$arrcopy = $arr;
$elem = array_splice($arrcopy, $i, 1); // removes and returns the i'th element
@maxstudener
maxstudener / words.py
Created October 24, 2013 16:57
Word Combination
import sys
from itertools import permutations
from sets import Set
def lo(item):
return item.lower()
word =sys.argv[1]
file = open('/usr/share/dict/words')
@maxstudener
maxstudener / words.rb
Last active December 26, 2015 10:59
Word Combinations
require 'benchmark'
puts Benchmark.measure{
words = {}
real_words = {}
for infile in File.read("/usr/share/dict/words").downcase.split("\n") do
words[infile] = true
end
@maxstudener
maxstudener / words.py
Created October 24, 2013 16:44
Word Combinations
import sys
from itertools import permutations
words = {}
real_words = {}
for line in open('/usr/share/dict/words').read().split("\n"):
words[line.lower()] = True
for i in range(sys.argv[1].__len__()):