Skip to content

Instantly share code, notes, and snippets.

# Install mysql
brew install mysql
# pin the version so you don't override it accidentally with upgrate
brew pin mysql
# Copy launch agent into place
mkdir -p ~/Library/LaunchAgents && cp /usr/local/Cellar/mysql/<version>/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
# Edit launch agent and set both keepalive and runatload at startup to false
public class WebLinkValidator {
private final static String linkRegex = "((([A-Za-z]{3,9}:(?://)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:/[\\+~%/\\.\\w\\-]*)?\\??(?:[\\-\\+=&;%@\\.\\w]*)#?(?:[\\.\\!/\\\\\\w]*))?)";
/**
* Examples of valid web links are:
* <ul>
* <li>"www.site.com"</li>
* <li>"http://www.site.com"</li>
* <li>"mailto:lucy@site.com"</li>
[url "git@github.com:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
@vpilot
vpilot / JPAValidation
Last active August 29, 2015 13:56
Regex Tips
// email validation, supports only lower case emails
@Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\."
+"[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"
+"(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",
message="Invalid Email")
protected String email;
// not blank
@NotNull(message="Title can not be NULL.")
@Pattern(regexp="^(?!\\s*$).+", message="Title can not be empty.")