# initial project
npm init
# install unit test dependencies, -D means --save-dev
npm install -D mocha chai sinon chai-http nyc
# integrate eslint & prettier & airbnb style guide
npm install -D eslint prettier
# peerdeps means to install corresponding airbnb version for eslint
npx install-peerdeps --dev eslint-config-airbnb
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
@Bean | |
public CorsConfigurationSource corsConfigurationSource() { | |
CorsConfiguration configuration = new CorsConfiguration(); | |
configuration.setAllowedOrigins(List.of("*")); // Allow all origins, or specify specific ones | |
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); // Allow all methods | |
configuration.setAllowedHeaders(List.of("*")); // Allow all headers | |
configuration.setAllowCredentials(true); // Allow credentials like cookies | |
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | |
source.registerCorsConfiguration("/**", configuration); // Apply CORS config to all endpoints |
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 React, {useState, useCallback} from "react"; | |
export const AllForexPairs = [ | |
{ | |
key: "USD_JPY", | |
label: "USD/JPY", | |
}, | |
{ | |
key: "AUD_USD", | |
label: "AUD/USD", |
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
using PkgTemplates | |
t = Template(user="unclebean", license="MIT", dir="~/code", authors=["unclebean"], plugins=[TravisCI(),Codecov(),Coveralls()]) | |
generate("Project", t) |
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
// remove none image | |
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}") | |
// remove image with dependent child images | |
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) | |
// show stopped container | |
docker ps --filter "status=exited" |
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
java 8 | |
Lambdas | |
List<Person> people = loadPeolple(); | |
people.sort((p1, p2) -> p1.name.compareTo(p2.name)); | |
// no need final | |
public UnaryOperator<String> upperCaser(Locale locale) { | |
return str -> str.toUpperCace(locale); | |
} |
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
set smartindent | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
# very nice vimrc configuration | |
# https://github.com/amix/vimrc |
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
{:comeonin, "~> 4.0"} | |
mix deps.get | |
|> put_pass_hash() |
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
docker run --name postgres-jira -p 5432:5432 -e POSTGRES_PASSWORD=12345678 -v ~/atlassian/postgresql:/var/lib/postgresql/data -e POSTGRES_DB=jiradata -e POSTGRES_USER=jira -d postgres:9.4 |
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
<html> | |
<head> | |
<style> | |
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} |