Short articles, references and checklists to keep control of application quality.
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: kube-dns | |
namespace: kube-system | |
labels: | |
k8s-app: kube-dns | |
kubernetes.io/cluster-service: "true" | |
kubernetes.io/name: "KubeDNS" | |
spec: |
After migrating from heroku to dokku, we had to also chance codeship so we deploy to dokku. I followed the following steps to successfully deploy to dokku.
- Save the public key of the codeship project. It is found in Project Settings > General Settings.
- Copy the public key to a file /tmp/codeship_projectname.pub.
- Make sure when pasting, all the contents are in a single line and not multiple lines.
- Add the public key to dokku using the following command in console. Reference.
cat /tmp/codeship_projectname.pub | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
function circularJSONStringify(obj) { | |
const cache = []; | |
const result = JSON.stringify(obj, (key, value) => { | |
if (typeof value === 'object' && value !== null) { | |
if (cache.indexOf(value) !== -1) { | |
// Circular reference found, discard key | |
return; | |
} | |
// Store value in our collection | |
cache.push(value); |
This guide describes how to bootstrap new Production Core OS Cluster as High Availability Service in a 15 minutes with using etcd2, Fleet, Flannel, Confd, Nginx Balancer and Docker.
// Bad | |
books.forEach(book => { | |
if (book[title]) { | |
if (book[author]) { | |
console.log(book) | |
} | |
} | |
}) | |
// Good |
Custom recipe to get full Node.js Cloud Environment in DigitalOcean Dokku droplet running from scratch. Yes. Your own Heroku for $5 per month.
I use this gist to keep track of the important configuration steps required to have a functioning system after fresh install.
When you have executed that's all step by step you will get a new working and stable system which is ready to host & serve your Node.js application and databases.
{ | |
"ru": { | |
"Your original english text": "Твой оригинальный русский текст" | |
} | |
} |
function offset(count, offset, limit) { | |
const finalOffset = Math.max(Math.min(count, offset), 0); | |
const remainedCount = Math.min(count, count - finalOffset); | |
const finalCount = (typeof limit === 'number') ? Math.min(limit, remainedCount) : remainedCount; | |
return { offset: finalOffset, finalCount: finalCount }; | |
} | |
console.log(offset(10, 0)); // {"offset":0,"finalCount":10} | |
console.log(offset(10, 4)); // {"offset":4,"finalCount":6} | |
console.log(offset(10, 10)); // {"offset":10,"finalCount":0} |