View .spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
View jdp-module.js
const aModule = (function() {
const _username = "infosec";
const _URLBase = "/posts";
function _buildURL(first, last) {
return `${first} ${last}'s URL is: ${_URLBase}/${_username}`;
}
return {
unusedProperty: 'Hellooo!',
View jdp-mod-not-object.js
const almostAModule = (function() {
const privateUsername = "infosec";
const privateURLBase = "/posts";
function privateBuildURL(user, URL) {
return `${URL}/${user}`;
}
return publicBuildURL(privateUsername, privateURLBase);
})();
View jdp-mod-iife.js
const stillNotAModule = (function() {
const username = "infosec";
const urlBase = "/posts";
function buildURL(user, URL) {
return `${URL}/${user}`;
}
return buildURL(username, urlBase);
})();
View jdp-mod-fe.js
const notAModuleYet = function() {
const username = "infosec";
const urlBase = "/posts";
function buildURL(user, URL) {
return `${URL}/${user}`;
}
return buildURL(username, urlBase);
};
View jdp-ns-object-notation.js
// All of our company's code would be here
var wellDesigned = wellDesigned || {};
// Maybe we have a department
var wellDesigned.productX = wellDesigned.productX || {};
// Maybe we're developing Libraries
var wellDesigned.productX.libs = wellDesigned.productX.libs || {};
// And this one is intended to be used with React only
View jdp-ns-object-literal.js
// objectA will contain both objects "B"
var objectA = {};
var objectA.objectB1 = {
property1: "a string";
property2: "another string";
method1: function() {
// returns a string
return this.property1 + this.property2;
View jdp-ns-underscore
// Maybe our company is called Well Designed
// And we're creating some utility code:
var WellDesigned_Utils_alertMessage;
var WellDesigned_Utils_errorMessage;
var WellDesigned_Utils_warningMessage;
View unique-variable.js
// Let's say we're creating iTunes from scratch!
var iHopeNoOneElseUsesThisPrefix_albumTotal;
// I would go crazy...
var iHopeNoOneElseUsesThisPrefix_songTotal;
View jdp-ol-refactored.html
<script>
var TRU_DAT = {
message: '',
spacemacs: function() {
var vim = 333;
var emacs = 333;
return vim + emacs;
},
};