https://www.youtube.com/watch?v=FEs2jgZBaQA&list=UUzoVCacndDCfGDf41P-z0iA
Ideally, you'd want a page speed score of:
- 85 for Mobile
- 90 for Desktop
[1, 2, 3, 4, 5].duplicate(); | |
// My initial attempt | |
Array.prototype.duplicate = function() { | |
var arr = this.slice(0); | |
arr.forEach(function(e) { | |
arr.push(e); | |
}); |
#define N // number of buffers | |
int in = 0, out = 0; // Reader and writer pointers to buffer spaces | |
// Semaphores | |
resources = 0; // number of resources that we are producing | |
buffer = N; // buffer space | |
mutex = 1; // Mutual exclusion to make sure we aren't reading and writing at the same time | |
criticalA = 1; // critical A and B are used to enforce the requirement that we produce A, then B, then A, etc... | |
criticalB = 1; |
https://www.youtube.com/watch?v=FEs2jgZBaQA&list=UUzoVCacndDCfGDf41P-z0iA
Ideally, you'd want a page speed score of:
var gulp = require('gulp'); | |
var util = require('gulp-util'); | |
var watchify = require('watchify'); | |
var reactify = require('reactify'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var browserSync = require('browser-sync'); | |
var reload = browserSync.reload; |
/** | |
* Write a function for doing an in-place shuffle of an array. | |
* | |
* The shuffle must be "uniform," meaning each item in the | |
* original array must have the same probability of ending up | |
* in each spot in the final array. | |
* | |
* Must be done in O(n) time and O(1) space | |
*/ |
function Constructor() { | |
const privateMember = Symbol('privateMember'), | |
publicMember = 'publicMember'; | |
this[privateMember] = 'foo'; | |
this[publicMember] = 'bar'; | |
} | |
let c = new Constructor(); |
function User(username) { | |
const secretPasswordKey = Symbol('password'); | |
this.username = username; | |
this.setPassword = function setPassword(password) { | |
this[secretPasswordKey] = password; | |
}; | |
this.authenticate = function authenticate(attempt) { |
function Closure() { | |
var number = 0; | |
// Manipulate the private member directly | |
function makeLower() { | |
number--; | |
console.log(number); | |
} | |
// Manipulate the private member directly |
el.addEventListener('click', function (e) { | |
e.target.style.display = 'none'; | |
}); | |
// Instead of using jQuery's $('selector') for grabbing an element, just use these | |
var elem = document.querySelector('selector'); // Returns a DOM Node | |
var elems = document.querySelectorAll('selector'); // Returns a nodelist | |
// Then for event listeners it's just: | |
elem.addEventListener('click', function (e) { |