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
public class Something { | |
private Something() { | |
} | |
private static class LazyHolder { | |
public static final Something INSTANCE = new Something(); | |
} | |
public static Something getInstance() { | |
return LazyHolder.INSTANCE; |
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
<bean id="templateResolver" | |
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"> | |
<property name="prefix" value="/WEB-INF/views/" /> | |
<property name="suffix" value=".html" /> | |
<property name="templateMode" value="HTML5" /> | |
</bean> | |
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> | |
<property name="templateResolver" ref="templateResolver" /> | |
</bean> |
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
public class ServletThreadSafety extends HttpServlet { | |
/* | |
* Since we have the context lock, we're assuming that once we get inside the synzchonized block, | |
* the context attributes are safe from other threads until we exit the block... soft of. Safe | |
* means "safe from any other code that ALSO synchonizes on the ServletContext". | |
* | |
* But this is the best you've got for making the context attributes as thread-safe as you can. | |
*/ | |
@Override | |
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
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
package sample.uic.web.controller; | |
import sample.uic.model.Organization; | |
import sample.uic.model.OrganizationUser; | |
import sample.uic.model.User; | |
import sample.uic.service.OrganizationService; | |
import sample.uic.service.UserService; | |
import com.google.common.collect.Lists; | |
import org.junit.Before; | |
import org.junit.Test; |
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
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
/** | |
* JSONView.css | |
* Custom Stylesheet for the JSONView Chrome extension | |
* | |
* by Scott Buchanan <[email protected]> | |
* http://wafflesnatcha.github.com | |
*/ | |
html, body { | |
margin: 0; |
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
git config --global https.proxy http://127.0.0.1:1080 | |
git config --global https.proxy https://127.0.0.1:1080 | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
npm config delete proxy |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- <configuration debug="true"> 调试模式下,可输出logback的内部日志信息 --> | |
<configuration debug="false"> | |
<!-- 控制台输出 --> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> | |
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 [%file:%line]日志所在文件及行数 %msg%n消息及换行--> | |
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%level][%thread]:%logger{50} [%method:%line] %msg%n</pattern> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
<localRepository>/opt/devtools/maven/repo</localRepository> | |
<mirrors> | |
<mirror> | |
<id>maven-aliyun-mirror</id> | |
<name>maven-aliyun-mirror</name> | |
<url>http://maven.aliyun.com/nexus/content/groups/public/</url> |
OlderNewer