Skip to content

Instantly share code, notes, and snippets.

module.exports = function(Session) {
Session.search = function(boardTypes,vehicleTypes,preferences, cb) {
var msg = "select * from session";
Session.dataSource.connector.query(msg,function (err, sessions) {
if (err) {
console.error(err);
} else {
console.log(sessions);
}
@dorwardv
dorwardv / LeastSwapPermutatedString
Created January 16, 2015 16:00
To run: python LeastSwapPermutatedString.py "abcd" "dcba" untested with corner cases
import sys
import itertools
import array
import math
from sets import Set
from operator import add
def combinations(str):
lst = list(str)
words=Set()
@dorwardv
dorwardv / input.txt
Last active August 29, 2015 14:13
palindrome.py all subsets of the characters in a string, palindrome2.py substrings of a string only, input.txt sample input
10
a
b
c
aba
baa
aabaa
hellolleh
habibah
zzzz
dorwardv@Raistlin:~/projects/personal/python/is_anagram$ python anagram.py "A telephone girl" "Repeating 'Hello'"
array('i', [1, 0, 0, 0, 3, 0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0])
array('i', [1, 0, 0, 0, 3, 0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0])
True
dorwardv@Raistlin:~/projects/personal/python/is_anagram$ python anagram.py "The United States Bureau of Fisheries" "I Raise the Bass to Feed Us in the Future"
array('i', [2, 1, 0, 1, 6, 2, 0, 2, 3, 0, 0, 0, 0, 1, 1, 0, 0, 2, 4, 4, 3, 0, 0, 0, 0, 0])
array('i', [2, 1, 0, 1, 6, 2, 0, 2, 3, 0, 0, 0, 0, 1, 1, 0, 0, 2, 4, 4, 3, 0, 0, 0, 0, 0])
True
dorwardv@Raistlin:~/projects/personal/python/is_anagram$ python anagram.py "Just because some of us can read and write and do a little math, that doesn't mean we deserve to conquer the universe." "Just because some of us can read and write and do a little math, that doesn't mean we deserve to conquer the universe."
array('i', [9, 1, 3, 6, 16, 1, 0, 3, 3, 1, 0, 2, 3, 7, 6, 0,