Install Rubocop by adding it to your Gemfile:
gem 'rubocop'
gem 'rubocop-rails'
And running:
bundle install
| ### | |
| # Statefulset | |
| ### | |
| apiVersion: apps/v1 | |
| kind: StatefulSet | |
| metadata: | |
| name: [STATEFULSET_NAME] | |
| spec: | |
| serviceName: [SERVICE_NAME] | |
| replicas: 3 |
| #list all volumes with detail information, helpful to know when to remove or prune unused volumes | |
| docker volume inspect $(docker volume ls | awk '{print $2}' | paste -sd " " -) | |
| # |
| const getQueryObject = (queryString) => { | |
| const queries = queryString ? queryString.split('&').map((e)=>{ var v = e.split('='); var n = {}; n[v[0]] = v[1]; return n}) : []; | |
| const o = queries.reduce((p,c)=>{ | |
| return Object.assign(p,c); | |
| },{}); | |
| return o; | |
| } |
| export const separate = (value: string, groupCount: number, separator = ' ') => { | |
| if ((value === undefined || value === null) || (groupCount === null || groupCount === undefined)) { | |
| throw new Error('value and groupCount are required'); | |
| } | |
| let reuslt = ''; | |
| value.split('').forEach((c, i) => { | |
| const currentPos = i + 1; | |
| let isSeparatable = currentPos % groupCount === 0 && currentPos !== value.length; | |
| if (isSeparatable) { | |
| reuslt = `${reuslt}${c}${separator}`; |
| let wrapper = function (bb, context) { | |
| this.doWrap(bb, context); | |
| }; | |
| wrapper.prototype.doWrap = function(bb, context) { | |
| for(let key in bb){ | |
| if(typeof bb[key] === 'function') { | |
| wrapper.prototype[key] = function() { | |
| console.log('before', context); | |
| bb[key].apply(null,arguments); |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="description" content="Async parallel loop"> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script src="https://rawgit.com/caolan/async/v1.5.2/dist/async.min.js"></script> |
| var templateEngine = function(html, options) { | |
| var re = /<%(.+?)%>/g, | |
| reExp = /(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g, | |
| code = 'with(obj) { var r=[];\n', | |
| cursor = 0, | |
| result; | |
| var add = function(line, js) { | |
| js? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') : | |
| (code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : ''); | |
| return add; |
| function doIt(someArray){ | |
| var result = []; | |
| var realResult = []; | |
| someArray.forEach(function(ele){ | |
| result.push(doPromise(ele)) | |
| }); | |
| function doPromise(element){ | |
| return new Promise(function(resolve, reject){ | |
| if(element == null)reject('Dont send me garbage'); |