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
/* | |
Program: Get all possible Permutations of a known number of words in a string | |
Author: Chapman Siu | |
Description: | |
Using proc plan and proc transpose, a data set is generated which has all possible | |
permutations. | |
Then a macro is writen to allow text to be scanned and concatenate to form a new string. | |
*/ |
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 re | |
from string import strip | |
def blueS(string): | |
if re.search("^\d+\.\d+$",strip(string)): | |
return 'float' | |
elif re.search("^\d\d-\d\d-\d{4}$",strip(string)): | |
return 'date' | |
elif re.search("^[-+]?\d+$",strip(string)): | |
return 'int' |
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
#day1 questions | |
puts "Hello, world" | |
puts "Hello, Ruby".index("Ruby") | |
x=0 | |
while x < 10 | |
puts "Chapman" | |
x = x + 1 | |
end |
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
dict = File.open('selected_four-letter_words.txt').map {|word| word.chomp} | |
#grab the two words so that you know what you're comparing with! | |
def one_letter(input,dict) | |
output = [] | |
dict.each do |word| | |
letterDiff = 0 | |
word.split('').to_enum.with_index {|letter,i| letterDiff = letterDiff+1 if letter == input[i]} | |
output << word if letterDiff == 3 |
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
data test; | |
input a $1-200; | |
cards; | |
Organisation trades in a high risk country China, [JURIS: CHN] and is | |
also involed in charity [INDUSTRY: CHARITY]. Customers acquisition | |
date is [ACQUISITION_DATE: 10JUL1999] | |
Customer A is a [JOB: SOLE TRADER] | |
; | |
run; |
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/python | |
############################################################################## | |
# Emilio Schapira | |
# Copyright (C) 2003 Advanced Interface Technologies, Inc. | |
# http://www.advancedinterfaces.com | |
# http://sourceforge.net/projects/pycron/ | |
# | |
# This program is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU General Public License as published by the |
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
#chall 74 in ruby | |
#zeckendorf representation | |
def fib_seq(m) | |
#get array of fibonacci seq up to a certain number | |
seq = [1,1] | |
until seq[-1] > m do | |
seq.push(seq[-1]+seq[-2]) | |
end |
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
#chall80 | |
#anagrams - no bonus | |
#idea, each word will have a 'fingerprint' by alphabetical ordering of the word | |
def anagram(m) | |
File.open('enable1.txt').map {|word| | |
word.chomp.chars.sort.join == m.chars.sort.join ? word.chomp : nil | |
}.compact | |
end |
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 guess_rank | |
x=rand(100)+1 | |
print "Guess number between 1-100: " | |
guess = x+1 | |
while x!=guess | |
guess = gets.to_i | |
puts "lower" if x<guess | |
puts "higher" if x>guess | |
puts "correct" if x==guess | |
end |
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
#module to do a clean up for tangle.js | |
import markdown | |
import re | |
import ast | |
import yaml | |
import jinja2 | |
import os | |
""" |
OlderNewer