Skip to content

Instantly share code, notes, and snippets.

View jendiamond's full-sized avatar
🏠
Working from home

JenDiamond jendiamond

🏠
Working from home
View GitHub Profile

NAVBAR

My navigation bar is in the body tag. Entire code for navigation bar is in nav.html file (without any html or body tag, only the code for navigation bar).

In the target page, this goes in the head tag:

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

Then in the body tag, a container is made with an unique id and a javascript block to load the nav.html into the container, as follows:

Add a styles.css page

  • Transfer all the styles from your pages to one page named styles.css
  • Add all the code below to the styles.css page
    • These are the styles for your navbar
 /* Add a black background color to the top navigation */
.topnav {
    background-color: #333;

Install N

"N" is a Node Version Manager

$ https://www.npmjs.com/package/n

install Node and NPM (they come together)

$ node -v

@jendiamond
jendiamond / cities.json
Last active January 19, 2018 23:11
Largest US Cities By Population && Geographic Coordinates, in JSON 2018 according to http://worldpopulationreview.com/us-cities/ & https://gist.github.com/Miserlou/c5cd8364bf9b2420bb29 First 100 are 2018 calculations all others are from 2013
[
{
"city": "Los Angeles",
"latitude": 34.0522342,
"longitude": -118.2436849,
"population": "4,030,668",
"rank": "1",
"state": "California"
},
{
function words(str) {
return str.split(" ").reduce(function(count, word) {
count[word] = count.hasOwnProperty(word) ? count[word] + 1 : 1;
return count;
}, {});
}
function findFirstWordWithMostRepeatedChars(text) {

Checking for existance

If all these things are True Run the function

  if ((obj instanceof Object) &&
      (Array.isArray(obj[key])) &&
      (obj.hasOwnProperty(key)) &&
      (obj[key].length !== 0)) {

A recipe for solving problems ⚡️⚡️

https://learn.makerpass.com/groups/ssp7w/courses/reactorcore/ssp-7w?id=module3%2Fhow-to-run-your-interview https://gist.github.com/jendiamond/a4254b4bffb479b27fbe99d0ac96ac86

Really read the problem

Read it slowly.
Read it again.

Write a function called “getElementsLessThan100AtProperty”. Given an object and a key, “getElementsLessThan100AtProperty” returns an array containing all the elements of the array located at the given key that are less than 100.