Skip to content

Instantly share code, notes, and snippets.

View TomFrost's full-sized avatar

Tom Shawver TomFrost

View GitHub Profile
@TomFrost
TomFrost / prompt_frost_setup
Last active February 25, 2017 03:29
Frost theme for ZSH via Prezto. Add to ~/.zprezto/modules/prompt/functions
#
# All information at your chilly fingertips.
#
# Authors:
# Tom Frost <tom@frosteddesign.com>
#
# Screenshots:
# http://i.tomfro.st/U1Kov.png
#
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
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
);