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
{ | |
"jest": { | |
"testMatch": [ | |
"**/__tests__/**/*.test.js" | |
], | |
"moduleNameMapper": { | |
"^~/(.*)": "<rootDir>/src/$1" | |
}, | |
"setupFilesAfterEnv": [ | |
"@testing-library/react/cleanup-after-each", |
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
const axios = require('axios'); | |
module.exports = async receivingServiceURL => { | |
const axiosInstance = axios.create({ | |
baseURL: 'http://metadata.google.internal/', | |
timeout: 10000, | |
headers: {'Metadata-Flavor': 'Google'} | |
}); | |
return axiosInstance.get(`computeMetadata/v1/instance/service-accounts/default/identity?audience=${receivingServiceURL}`).then(response => { |
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
import org.apache.commons.codec.binary.Base64; | |
import org.apache.commons.codec.digest.DigestUtils; | |
import java.security.MessageDigest; | |
/** | |
* Created by Scott on 2018/8/4. | |
*/ | |
public class Main { | |
public static void main(String[] args){ |
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
const suppose = require('suppose') | |
, fs = require('fs'); | |
suppose('npm', ['login', '--registry=http://npm.sencha.com', '--scope=@extjs'], {debug: fs.createWriteStream(__dirname+'/debug.txt')}) | |
.when('Username: ' ).respond('{{YOUR_EMAIL}}\n') | |
.when('Password: ' ).respond('{{YOUR_PASSWORD}}\n') | |
.when('Email: (this IS public) ' ).respond('[email protected]\n') | |
.on('error', (err)=>{ | |
console.error(err.message); | |
}) |
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
const _ = require('lodash'); | |
const pathToRegexp = require('path-to-regexp'); | |
const pattern = "/activity/:_id"; | |
const url = "/activity/123"; | |
const match = getMatch({pattern, url}); | |
console.log(match); | |
function getMatch({pattern, url}){ | |
let keys = []; |
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
var gcloud = require('google-cloud'); | |
var storage = gcloud.storage; | |
var fs = require('fs'); | |
module.exports = ()=> { | |
return new Promise((resolve, reject)=> { | |
var gcs = storage({ | |
projectId: 'PROJECT_ID', | |
keyFilename: __dirname+'/keys.json' | |
}); |
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
<div dangerouslySetInnerHTML={{ __html: htmlString}}></div> |
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
※ CI server | |
@Setting tomcat for runtime deploy | |
1.server.xml | |
<Host path="/" name="localhost" appBase="webapps" | |
unpackWARs="true" autoDeploy="false"> | |
2.context.xml | |
<Context antiResourceLocking="true"> | |
3.tomcat-users.xml | |
<role rolename="admin-gui"/> | |
<role rolename="admin-script"/> |