Skip to content

Instantly share code, notes, and snippets.

# 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)"

Welcome Intro to Ruby on Rails!

rails_image


Hi! I'm...

  • Sung Kim
  • I'm a software engineer & data scientist at Booz Allen Hamilton.
## First Hello world
puts "what is your name??"
name = gets.chomp
puts "Hi #{name}, how are you??"
#############
# Variables #
#############
@sk187
sk187 / displayNone_Hack.js
Last active August 29, 2015 14:21
Display None Transition Hack
////////////////////
//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)
@sk187
sk187 / python_lambda_syntax.py
Created April 8, 2015 16:48
Python Lamba Syntax
# 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]
@sk187
sk187 / python_iterating_over_dictionaries.py
Created April 8, 2015 16:29
Python Iterating Over Dictionaries
# Iterating over Dictionaries in Pythin is really straight forward
dictionary = {
"a" : "A",
"b" : "B",
"c" : "C",
"d" : "D"
}
# Get all items in the Dictionary
@sk187
sk187 / python_list_slicing.py
Created April 8, 2015 16:17
Python List Slicing
# 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]
@sk187
sk187 / list_comprehension_syntax.py
Created April 8, 2015 15:58
List Comprehension Syntax
# 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
@sk187
sk187 / python_recursion_factorial_example.py
Created April 6, 2015 19:03
Python Recursion Factorial Example
'''
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
@sk187
sk187 / install_nlpk_lda.py
Last active August 29, 2015 14:18
Install NLPK, LDA and Beautiful Soup for Sublime REPL
# 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