Skip to content

Instantly share code, notes, and snippets.

View deeTEEcee's full-sized avatar

David Chen deeTEEcee

View GitHub Profile
@deeTEEcee
deeTEEcee / gist:a3a65c6107cace2858dc
Created November 25, 2015 17:50
OSX.sublime-keymap
[
//// general
{ "keys": ["super+shift+s"], "command": "save" },
{ "keys": ["super+alt+s"], "command": "prompt_save_as" },
{ "keys": ["super+s"], "command": "save_all" },
{ "keys": ["super+ctrl+x"], "command": "alignment" },
//// navigation
{ "keys": ["super+b"], "command": "toggle_side_bar" },
{ "keys": ["f3"], "command": "goto_definition" },
{ "keys": ["alt+left"], "command": "jump_back" },
@deeTEEcee
deeTEEcee / gist:ad04b356b4a7feefab8e
Created November 25, 2015 17:56
bash_profile essentials (OSX)
export EDITOR=subl
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
@deeTEEcee
deeTEEcee / terminal.txt
Created November 30, 2015 01:31
terminal commands
# Compile
irb, ruby
python
g++ name.cpp -o file;./file # C++
# Search
# Rails
@deeTEEcee
deeTEEcee / functions.rb
Last active August 21, 2017 20:59
Ruby custom functions that could be useful
### For when you want to round up/down in custom increments of any number x (rather than just floating point rounding up to whole number)
# round_up(5, 20) -> 20
# round_up(35,20) -> 40
def round_up(num, round_by)
(num / round_by.to_f).ceil * round_by
end
# round_down(5, 20) -> 0
# round_up(35, 20) -> 20
git --git-file=path <command> # run git commands without cding into directory
@deeTEEcee
deeTEEcee / gist:d5344be0c6c17134926998756d750fae
Created December 5, 2016 19:21
Coding Interview Resources
# Practice Questions
leetcode
lintcode
hackerrank
https://www.reddit.com/r/cscareerquestions/comments/20ahfq/heres_a_pretty_big_list_of_programming_interview/
http://maxnoy.com/interviews.html
# References
https://www.gitbook.com/book/xmruibi/interview-preparation-notes/details
geeksforgeek
@deeTEEcee
deeTEEcee / gist:394a337edefb323c1d03fcf19e8914f3
Created December 28, 2016 23:00
Interview-related Links
http://blog.alinelerner.com/lessons-from-a-years-worth-of-hiring-data/
@deeTEEcee
deeTEEcee / flatten.rb
Last active February 20, 2017 18:12
Ruby internals
# an imitation of ruby's flatten which takes in a 2nd argument
def flatten(array, n=nil)
n = -1 if !n
while n != 0
is_flat = true
array = array.inject([]) do |acc, x|
if x.is_a?(Array)
is_flat = false
acc + x
else
@deeTEEcee
deeTEEcee / functions.py
Created August 21, 2017 21:00
Python functions that could be useful
# surprised that python does not have something like this in the iterator class or something.
def get_subset_from_dict(dict_obj, *keys):
return dict((k, dict_obj[k]) for k in keys)
@deeTEEcee
deeTEEcee / devtools.md
Last active February 6, 2020 22:54
Useful Developer Tools
  • ngrok # for opening local ports to web
  • daff # tool for csv file comparisons. (a bit limited in csv file size)
  • xsv # tool for csv file parsing. (filtering, selecting certain columns, works well with massive sizes)