Skip to content

Instantly share code, notes, and snippets.

View ElishaKay's full-sized avatar

Elisha Kramer ElishaKay

View GitHub Profile
@ElishaKay
ElishaKay / cluster.md
Created June 12, 2018 21:21 — forked from learncodeacademy/cluster.md
Node Cluster - Enhance your node app by using all the cores of your processor.

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
{
  "apiVersion": "v1",
  "kind": "Pod",
  "metadata": {
      "name": "pmm-server",
      "labels": {
          "name": "pmm-server"
      }
  },
  "spec": {
var app = express();
app.use(express.static('public'));
// For development, uncomment this line
app.listen(8000);
// app.listen(process.env.PORT || '4000');
@ElishaKay
ElishaKay / angularjs-http-get-xml.html
Created December 7, 2016 08:13
AngularJS $http Service (GET XML)
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>$http Service | AngularJS</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script>
<script type="text/javascript">
<!--
(function() {