This file contains hidden or 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 | |
| import shutil | |
| import argparse | |
| from os import path | |
| from sys import stderr | |
| # | |
| # Author: Daxda | |
| # Date: 02.04.2014 | |
| # WTF: This is a quick tool I've hacked together to easily remove the meta |
This file contains hidden or 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
| object TwoSum { | |
| def sum(n: Int, sorted: ArrayBuffer[Int]): Boolean = sorted.par.find(x => isMatch(x, n, sorted)).isDefined | |
| def isMatch(x: Int, n: Int, sorted: ArrayBuffer[Int]): Boolean = sorted.find( y => (x + y) == n).isDefined | |
| } |
This file contains hidden or 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
| var user = { | |
| validateCredentials: function (username, password) { | |
| return ( | |
| (!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
| : (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
| : (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
| : (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
| : (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
| : false | |
| ); |
NewerOlder