Skip to content

Instantly share code, notes, and snippets.

@jose8a
jose8a / JS-Execution
Last active January 2, 2020 00:36
JS Execution Context, Closures, This, Execution Order, Objects
##### Client-side Javascript Execution Order
http://javascript.about.com/od/hintsandtips/a/exeorder.htm
##### Phillip Roberts - What the heck is the Event Loop Anyways?
https://www.youtube.com/watch?v=8aGhZQkoFbQ
##### Javascript and the Browser - Under the Hood (video)
https://www.youtube.com/watch?v=dibzLw4wPms
http://esprima.org/demo/parse.html#
http://int3.github.io/metajs/
@jose8a
jose8a / MergeSort
Created May 4, 2015 22:32
InterviewProblem
//
@jose8a
jose8a / ResponsiveImages.md
Last active August 29, 2015 14:20
ResponsiveDesignNotes - ud893

Image size: Total bits = pixels * bits/pixel

To improve performance:

  • need to keep images as small as possible (less pixels) -AND-
  • compression as HIGH as possible (bits/pixel)
  • therefore, (less pixels) * (better compression) ==> LESS BYTES

For pictures:

  • don't assume window-size === screen-size
// Note that the Car constructor class contains
// an object property (.methods) even though it
// is a function. But, remember, in JS, everything
// is basically an object ... even functions
var Car = function(loc) {
var obj = {loc: loc};
// Extend: Popular JS method (not built-in) that adds/copies
// methods from a 'template' object to the newly created
// object. UnderscoreJS is popular lib that has an example
@jose8a
jose8a / FED Toolchain setup.md
Last active September 14, 2019 19:01
Setting up project template toolchain w/NPM and grunt

HTML5 Boilerplate Template

  1. Begin by using HTML5 Boilerplate as a starter project template,
  • download the template locall
  • add bash alias to copy that folder when starting a new project
  • e.g. $> 'html5-new PROJECTNAME' will create a folder named PROJECTNAME and will copy the contents of html5boilerplate into PROJECTNAME

Frontend Toolchain Setup

Need NodeJS, npm, grunt

  1. Then add the Frontend Toolchain using NPM and Grunt.
@jose8a
jose8a / Udacity_TDD.md
Created June 18, 2015 04:47
Notes on Udacity's JS TDD course

Jasmine library ..

SpecRunner.html --> top-level file for setting up and running tests on Jasmine Specs (XXXSpec.js, YYYSpec.js, etc) --> individual spec files container individual tests, as well as Suites of tests

describe --> identifies a "suite" -- that is, a group of related "specs" it --> identifies a spec in a "Test Suite" ... typically colored green

"Typical" test architecture:

Basic Callback Pattern

function shoutOutTo(param1, param2, callback) {
    alert('Holla, holla, holla!\nGiving a shoutOut to ' + param1);
    callback();
}

theHomie('Buster', function() {
    alert('Finished eating my sandwich.');
});
#!/bin/bash
### System upgrade and PG Install
#```
sudo apt-get update
#sudo apt-get dist-upgrade
sudo apt-get install postgresql postgresql-contrib
#```
### Switch to User Postgres and
#!/bin/bash
### Install and configure
sudo apt-get update
sudo apt-get install mysql-server libapache2-mod-auth-mysql
### Post-install, activate the db
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
### Leave root password blank, and decline changing password at end of install
#!/bin/bash
### URL: https://www.elastic.co/downloads/kibana
### Version 4.1.5 ... compatible with ES >= 2.0
### Download and unpack
wget https://download.elastic.co/kibana/kibana/kibana-4.4.1-linux-x64.tar.gz
tar -xvzf ./kibana-4.4.1-linux-x64.tar.gz
### Version 4.1.5 ... compatible with ES < 2.0