GET /accounts
GET /accounts/_mapping
GET /accounts/_search
{
"sort": [
{
"account_number": "asc"
View practical-intro-to-elasticsearch.md
View nginxproxy.md
Virtual Hosts on nginx (CSC309)
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
View install the go dep (the dependency management).md
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5110 100 5110 0 0 762 0 0:00:06 0:00:06 --:--:-- 1219
ARCH = amd64
OS = linux
Installation requires your GOBIN directory /home/xxx/go/bin to exist. Please create it.
View App-1.js
import React, { Component } from "react"; | |
class App extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
input1: "" | |
}; | |
this.handleChange = this.handleChange.bind(this); |
View setup-prettier-precommit-hook.sh
#!/usr/bin/env bash | |
npm i -D --save-exact prettier | |
npm i -D pretty-quick husky --save | |
# to manipulate the existing package.json file | |
npm i -g json | |
# add precommit to package.json scripts | |
json -I -f package.json -e 'this.scripts.precommit="pretty-quick --staged"' | |
# add prettier config file | |
touch .prettierrc | |
echo '{ |
View setup-node.sh
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
sudo apt-get update | |
sudo apt-get install -y nodejs build-essential gcc g++ make | |
# fixing npm permissions | |
mkdir ~/.npm-global | |
npm config set prefix '~/.npm-global' | |
# use the NPM_CONFIG_PREFIX=~/.npm-global if you don't want to modify the .bashrc | |
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc | |
source ~/.bashrc |
View jsinspect-report.log
Match - 2 instances | |
./components/A.js:1,36 | |
import React, { Component } from 'react'; | |
import { Link } from 'react-router'; | |
import ExpandImage from '../containers/assets/icon_expand.svg'; | |
import mapUS from '../containers/assets/map-us.svg'; | |
import mapEurope from '../containers/assets/map-europe.svg'; | |
import mapAsia from '../containers/assets/map-asia.svg'; |
View Error: there can only be one only test.log
Error: there can only be one only test | |
at Function.test.only (/my-node-app/node_modules/tape/index.js:140:25) | |
at Function.module.exports.lazyLoad.only (/my-node-app/node_modules/tape/index.js:26:34) | |
at Object.<anonymous> (/my-node-app/test/api-endpoints/submit-registration-token.test.js:47:6) | |
at Module._compile (module.js:624:30) | |
at Object.Module._extensions..js (module.js:635:10) | |
at Module.load (module.js:545:32) | |
at tryModuleLoad (module.js:508:12) | |
at Function.Module._load (module.js:500:3) | |
at Module.require (module.js:568:17) |
View hello-world-module.js
(exports => (exports.greet = () => "Hello world"))( | |
typeof exports === "undefined" ? (this["hello"] = {}) : exports | |
); |
View the-correct-approach-to-handle-stripe-timestamp.js
export function secondsToISOString(seconds) { | |
const date = new Date(seconds * 1000); | |
return date.toISOString(); | |
} |
NewerOlder