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
kind: Service # When service objects is created it will be assigned an internal cluster ip | |
apiVersion: v1 | |
metadata: | |
name: my-service # When a service with selector is crated, an Endpoints object with the same name is | |
spec: # also created. Endpoints is a collection of endpoints that implement the actual | |
selector: # service. It is updated when service are added/removed | |
app: MyApp # Selectors to identify the backing pods | |
env: Pord | |
ports: | |
- protocol: TCP # Default potocal is TCP |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
spec: | |
replicas: 3 | |
template: | |
metadata: | |
labels: # label will be applied to each pod, label key need to be unique | |
app: nginx |
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
apiVersion: apps/v1 | |
kind: ReplicationController | ReplicaSet | Deployment # different controller | |
==================================================== | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
spec: |
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
apiVersion: extensions/v1beta1 # Api Version | |
kind: Deployment # Object Type | |
metadata: # Metadata about this object | |
name: artifactory-test # Name of this deployment | |
spec: # Specification of this deployment | |
replicas: 1 # Number of replication | |
template: # Template used to create replica | |
metadata: # Metadata about the pods | |
labels: # labels used to identify the pods | |
app: artifactory-pro-standalone # label 'app' |
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 hashMap = { | |
Set : function(key,value){this[key] = value}, | |
Get : function(key){return this[key]}, | |
Contains : function(key){return this.Get(key) == null?false:true}, | |
Remove : function(key){delete this[key]} | |
} | |
// to avoid collision in key, try to use unique string as key. If we want to handle key value other than string, or some two different key | |
// that result the same with toString, wo can roll our own hash method, to turn different type input into different key string | |
// or, We can use ES6 Map |
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
function height(node){ | |
if(!node) return 0; | |
var leftHeight = height(node.left); | |
var rightHeight = height(node.right); | |
return Math.max(leftHeight, rightHeight) + 1; | |
} |
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 form1 = document.getElementById('foo-bar').elements; | |
var form2 = document.getElementById('foo-bar-baz-qux').elements; | |
function getObject(inputs){ | |
var cur = {} | |
for(var i=0;i<inputs.length; i++){ | |
var names = inputs[i].name.split('.'); | |
var temp = cur; | |
for(var j=0; j < names.length; j++){ |
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 quickSort = function(arr) { | |
if (arr.length <= 1) { return arr; } | |
var pivotIndex = Math.floor(arr.length / 2); | |
var pivot = arr.splice(pivotIndex, 1)[0]; | |
var left = []; | |
var right = []; | |
for (var i = 0; i < arr.length; i++){ | |
if (arr[i] < pivot) { | |
left.push(arr[i]); | |
} else { |
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
function quickSelectInPlace(arr, k) { | |
if (!arr || arr.length <= k) { | |
throw 'Invalid input'; | |
} | |
var len = arr.length; | |
var from = 0; | |
var to = len - 1; | |
while (from < to) { | |
var left = from; |
NewerOlder