This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| http://blog.alinelerner.com/lessons-from-a-years-worth-of-hiring-data/ |
This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| git --git-file=path <command> # run git commands without cding into directory |
This file contains hidden or 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
| ### For when you want to round up/down in custom increments of any number x (rather than just the simple case of decimal points rounding up when we reach 0.5) | |
| # 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_down(35, 20) -> 20 |
This file contains hidden or 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
| # Compile | |
| irb, ruby | |
| python | |
| g++ name.cpp -o file;./file # C++ | |
| # Search | |
| # Rails |
This file contains hidden or 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
| 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\] $ " |
This file contains hidden or 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
| [ | |
| //// 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" }, |
NewerOlder