Skip to content

Instantly share code, notes, and snippets.

View jhcao23's full-sized avatar

John Cao jhcao23

View GitHub Profile
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
layout:decorator="fragments/layout" >
<body>
<p layout:fragment="page-title">
<h2 th:utext="#{welcome}">Welcome2</h2>
</p>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>/path/to/your/jdk6/bin/javac</executable>
<compilerVersion>1.6</compilerVersion>
<source>1.6</source>
<target>1.6</target>
@jhcao23
jhcao23 / .bash_profile
Last active May 22, 2017 17:13
Basic bash_profile setup for Java
#!/bin/bash
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export MAVEN_HOME=/usr/local/Cellar/maven/3.5.0/libexec
#PATH
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
@jhcao23
jhcao23 / virtual.conf
Last active November 25, 2017 22:41
nginx wide open CORS OPTIONS config
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
@jhcao23
jhcao23 / effect-mergemap.ts
Last active January 13, 2018 20:55
Effect dispatch multiple Actions
@Injectable()
export class AuthEffects {
@Effect()
LOGIN$ = this.actions$.ofType(LOGIN).pipe(
map((action: PayloadableAction<string>) => action.payload),
switchMap((code: string) =>
this.googleService.googleLogin(code).pipe(
mergeMap((response: HttpResponse<any>) => {
if (response.status === 200) {
const jwt: string = response.headers.get(NAME_HEADER_JWT);
@jhcao23
jhcao23 / git-cheat-sheet.md
Created February 28, 2018 02:31 — forked from iansheridan/git-cheat-sheet.md
A cheat sheet for GIT

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

@jhcao23
jhcao23 / git-cheat-sheet.md
Created February 28, 2018 02:39 — forked from juristr/git-cheat-sheet.md
My Git cheat sheet

Git Cheat Sheet

Committing and Undoing

Adding file for committing

$ git add <filename>
@jhcao23
jhcao23 / ToBeOrNotToBe.MD
Last active July 17, 2019 00:20
ToBeOrNotToBe
  if (it is yes) // to be
    go here...
  else // not to be
    go there...
@jhcao23
jhcao23 / DynamicStaticWebsite.md
Last active July 17, 2019 00:17
DynamicStaticWebsite
if (not dynamic)
  tech geek goes to github [pages]
  edit Markdown manually
else
  some code tools generate static web sites
  if (hosting on github)
    git push origin github
  else 
 var possibleAlternative = one of [