Skip to content

Instantly share code, notes, and snippets.

@sgyyz
sgyyz / gulp-ng-config.md
Last active January 13, 2017 14:27
Building angularjs configuration file by gulp-ng-config

gulp-ng-config

In our angularjs app, we usually call remote API to get data to make our app live. But we will have different environment for our app when we develop it or put it online. So we will meet the requirement to build our app for different environemnts. How to deal with it when you use gulp to build your app?

Yes, gulp-ng-config can help you to do it easily.

Introduction of gulp-ng-config

You can refer https://www.npmjs.com/package/gulp-ng-config to get more details of this plugin.

Install gulp-ng-config

Under your package.json file path,

@sgyyz
sgyyz / pom.xml
Created February 1, 2019 07:10
email-spring-boot-starter dependency
<dependency>
<groupId>io.57blocks</groupId>
<artifactId>email-spring-boot-starter</artifactId>
<version>0.1.3</version>
</dependency>
@sgyyz
sgyyz / application.yml
Created February 1, 2019 07:11
email-spring-boot-starter spring mail configuration
spring.mail:
host: email-smtp.us-west-2.amazonaws.com
username: username
password: password
properties:
mail.transport.protocol: smtp
mail.smtp.port: 25
mail.smtp.auth: true
mail.smtp.starttls.enable: true
mail.smtp.starttls.required: true
@sgyyz
sgyyz / pom.xml
Created February 2, 2019 02:49
aws ses dependency
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ses</artifactId>
<version>1.11.415</version>
@sgyyz
sgyyz / application.yml
Created February 2, 2019 02:50
aws cloud spring-boot configuration
cloud:
aws:
region:
static: us-east-2
credentials:
accessKey: accessKey
secretKey: secretKey
@sgyyz
sgyyz / resource-layout.txt
Created February 2, 2019 02:52
email-spring-boot-starter resource layout
email
├── html
│   └── greeting.html
├── messages.properties
├── messages_zh.properties
├── subject
│   └── greeting.txt
└── text
└── greeting.txt
@sgyyz
sgyyz / application.yml
Created February 2, 2019 02:53
email-spring-boot-starter default configuration
io.57blocks.email:
enabled: false
template:
prefix: /email/
message_base_name: messages
html:
pattern: html/*
suffix: .html
character_encoding: UTF-8
cacheable: false
@sgyyz
sgyyz / GreetingService.java
Created February 2, 2019 02:54
email-spring-boot-starter example
public class GreetingService {
@Autowired
private EmailService emailService;
public void sendEmail() {
try {
Map<String, Object> ctx = ImmutableMap.of("name", "Mr. Smith");
emailService.sendHtmlMail("Sender <[email protected]>", "greeting", Locale.CHINESE, ctx, "Mr. Smith <[email protected]>");
} catch (MessagingException e) {
@sgyyz
sgyyz / uao.md
Last active May 3, 2024 14:15
uao command - unzip your project and import to intellij automatically
  1. import project into idea command
$ curl -L "https://gist.githubusercontent.com/chrisdarroch/7018927/raw/9a6d663fd7a52aa76a943fe8a9bc6091ad06b18d/idea" -o /usr/local/bin/idea
$ chmod +x /usr/local/bin/idea
  1. unzip and open project command
$ curl -L "https://gist.githubusercontent.com/sgyyz/adfa4f05af3d81cf0e17e19cf7044c85/raw/b6b9e871d5a4f5435a09d00b0a52e3db0b90699a/uao.sh" -o /usr/local/bin/uao.sh
$ chmod +x /usr/local/bin/uao.sh
$ ln -sf /usr/local/bin/uao.sh /usr/local/bin/uao
@sgyyz
sgyyz / uao.sh
Created March 15, 2019 07:50
uao.sh
#!/bin/sh
fullFileName=$1
suffix=${fullFileName#*.}
if [ "$suffix" != "zip" ];then
echo "Must be a valid zip file"
else
filename=${fullFileName%.*}