Skip to content

Instantly share code, notes, and snippets.

View youngjinmo's full-sized avatar
👋
Hello world

Youngjin Mo youngjinmo

👋
Hello world
View GitHub Profile
@youngjinmo
youngjinmo / isPrimeNum.js
Last active November 13, 2018 07:09
example for function in JavaScript
var num=0;
function isPrime(num) {
// check number type
for(var i=2; i<num; i++) {
if (num % 2 === 0) {
var numType = "even";
} else if(num % i === 0) {
numType = "odd";
} else numType = "prime";
@youngjinmo
youngjinmo / Laugh it Off 2 (5-2).js
Last active November 13, 2018 07:14
Quiz 5-2 in Intro to JavaScript in Udacity
/*
* Programming Quiz: Laugh it Off 2 (5-2)
*
* Write a function called `laugh` with a parameter named `num` that represents the number of "ha"s to return.
*
*/
var num=0;
function laugh(num){
var str="";
@youngjinmo
youngjinmo / Build a Triangle (5-3) ver.fail.js
Created November 13, 2018 09:45
Failed my first answered that quiz 5-3 in Intro to JavaScript at Udacity.
/*
* Programming Quiz: Build A Triangle (5-3)
*/
// creates a line of * for a given length
function makeLine(length) {
var line = "";
for (var j = 1; j<=length; j++) {
line += "* ";
}
@youngjinmo
youngjinmo / Build a Triangle (5-3) ver.pass.js
Last active November 13, 2018 15:11
Passed second answer that quiz 5-3 in Intro to JavaScript at Udacity.
/*
* Programming Quiz: Build A Triangle (5-3)
*/
// creates a line of * for a given length
function makeLine(length) {
var line = "";
for (var j = 1; j<=length; j++) {
line += "* ";
}
@youngjinmo
youngjinmo / Inline (5-6) ver.fail.js
Created November 14, 2018 05:45
My first try, but failed. Because I missed using an inline function that function passed the another function.
/*
* Programming Quiz: Inline Functions (5-6)
*/
// don't change this code
function emotions(myString, myFunc) {
console.log("I am " + myString + ", " + myFunc(2));
}
// your code goes here
@youngjinmo
youngjinmo / Inline (5-6) ver.pass.js
Created November 14, 2018 05:45
Answer passed.
/*
* Programming Quiz: Inline Functions (5-6)
*/
// don't change this code
function emotions(myString, myFunc) {
console.log("I am " + myString + ", " + myFunc(2));
}
// your code goes here
@youngjinmo
youngjinmo / Another Type of Loop (6-8).js
Last active November 17, 2018 03:08
Comparison of Loop and forEach Loop
/*
* Programming Quiz: Another Type of Loop (6-8)
*
* Use the existing `test` variable and write a `forEach` loop
* that adds 100 to each number that is divisible by 3.
*
* Things to note:
* - you must use an `if` statement to verify code is divisible by 3
* - you can use `console.log` to verify the `test` variable when you're finished looping
*/
var bills = [50.23, 19.12, 34.01,
100.11, 12.15, 9.90, 29.11, 12.99,
10.00, 99.22, 102.20, 100.10, 6.77, 2.22
];
var totals = bills.map(function(element) {
element *= 1.15;
element = element.toFixed(2);
return Number(element);
});
@youngjinmo
youngjinmo / Nested Numbers (6-1).js
Created November 17, 2018 06:30
Arrays in Array Quiz in Intro to JavaScript at Udacity.
var numbers = [
[243, 12, 23, 12, 45, 45, 78, 66, 223, 3],
[34, 2, 1, 553, 23, 4, 66, 23, 4, 55],
[67, 56, 45, 553, 44, 55, 5, 428, 452, 3],
[12, 31, 55, 445, 79, 44, 674, 224, 4, 21],
[4, 2, 3, 52, 13, 51, 44, 1, 67, 5],
[5, 65, 4, 5, 5, 6, 5, 43, 23, 4424],
[74, 532, 6, 7, 35, 17, 89, 43, 43, 66],
[53, 6, 89, 10, 23, 52, 111, 44, 109, 80],
[67, 6, 53, 537, 2, 168, 16, 2, 1, 8],
@youngjinmo
youngjinmo / MySQL_macOS_Sierra.md
Created May 10, 2019 03:26 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :