- Sung Kim
- I'm a software engineer & data scientist at Booz Allen Hamilton.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Type this into your terminal. You will notice that we are actually using Ruby to install Homebrew. | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## First Hello world | |
puts "what is your name??" | |
name = gets.chomp | |
puts "Hi #{name}, how are you??" | |
############# | |
# Variables # | |
############# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////// | |
//JavaScript Logic// | |
//////////////////// | |
$('.project_btn').each(function(index) { | |
$(this).on('click', function(){ | |
$(this).addClass('selected') | |
$('.project_btn').not(this).removeClass('selected') | |
var tab = ($('.project.info').eq(index)) | |
var otherTabs = ($('.project.info').not(tab)) | |
console.log(index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python like Javascript is a functional langauge. It allows you to pass methods. | |
# To filter my_list for even numbers you can: | |
my_list = range(1,11) # Creates a list with the number 1 - 10 | |
# Filter Syntax is filter(params to filter by, list to filter) | |
print filter( lambda x: x%2==0, my_list) | |
# Returns | |
[2, 4, 6, 8, 10] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Iterating over Dictionaries in Pythin is really straight forward | |
dictionary = { | |
"a" : "A", | |
"b" : "B", | |
"c" : "C", | |
"d" : "D" | |
} | |
# Get all items in the Dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python list can be manipulated as follows: | |
my_list = [1,2,3,4,5,6,7,8,9,10] | |
# my_list[start_index : end_index : stride] | |
# Default for start index is 0 | |
# Default for end index is the end of the list | |
even_num_list = my_list[1::2] | |
# Returns | |
[2, 4, 6, 8, 10] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creating a List of numbers from 1 to 10 can be done with: | |
list_1_to_10 = range(1,11) | |
# Returns | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
# But what if you wanted only the even numbers? Use the List comprehension syntax! | |
even_num_list = [x for x in range(1,11) if x % 2 == 0] | |
# Returns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Recursion can be difficult for beginners. It still is difficult for me. | |
The best way to improve is to try "easy" recursion problems such as | |
factorials in this case. | |
Instructions: | |
Create a function that takes an positive interger and returns the factorial of it | |
Example factorial(3) should return 3*2*1 or 6 | |
Factorial(1) should return 1 | |
Factorial(0) should return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This guide is for people who have install Sublime REPL and linked their system Python to it. | |
# If you haven't but want to, refer to my previous post where I show you how. | |
# If you are using Python 3 and still have Python 2 installed on your system as default | |
# For NLTK | |
python3 -m pip install -U nltk | |
# For LDA | |
python3 -m pip install lda |