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
require_relative "./linked_list.rb" | |
class LinkedList | |
# Reuses list nodes from the specified node | |
# to the end of the list. | |
# The complexity of this method is O(n) where n | |
# is the distance from the target node to the | |
# end of the list. | |
def reuse_from_node node |
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
class LinkedList | |
class Node | |
attr_accessor :next, :data | |
def initialize data | |
self.data = data | |
self.next = nil | |
end | |
end | |
attr_accessor :head, :tail, :length |
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
hi clear | |
if &t_Co > 255 | |
" hi Normal ctermbg=234 | |
hi CursorLine ctermbg=235 cterm=none | |
hi CursorLineNr ctermfg=208 cterm=none | |
hi Boolean ctermfg=135 | |
hi Character ctermfg=144 | |
hi Number ctermfg=135 | |
hi String ctermfg=156 |
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
class Stack | |
class Node | |
attr_accessor :next, :data | |
def initialize data | |
self.data = data | |
self.next = nil | |
end | |
end | |
attr_accessor :head, :tail, :length |
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
// All of this sortcuts are ergonomic if you remap | |
// CAPS -> Ctrl | |
// Right Opt -> Esc | |
//(I use Karabiner-Elements for that.) | |
[ | |
{ "keys": [",", "/"], | |
"context": [ | |
{ "key": "setting.command_mode", "operand": true }, | |
{ "key": "setting.is_widget", "operand": false } | |
], |
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
#!/bin/bash | |
# This is a wraper around the standard find command that excludes directories | |
# we typically want to ignore while working with source code. | |
# This function is handy when we are trying to fuzzy find files using tools like | |
# *selecta* | |
find * -type f \ | |
-not -path "_build/**" \ | |
-not -path "bin/**" \ | |
-not -path "deps/**" \ | |
-not -path "doc/**" \ |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>author</key> | |
<string>github.com/jzelenkov</string> | |
<key>colorSpaceName</key> | |
<string>sRGB</string> | |
<key>gutterSettings</key> | |
<dict> |
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
require_relative "./linked_list.rb" | |
class DoublyLinkedList < LinkedList | |
class Node < LinkedList::Node | |
attr_accessor :prev | |
end | |
# Inserts a new item into the list. | |
# Complexity: O(1). | |
def insert data |
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
Show hidden characters
{ | |
// http://www.sublimetext.com/docs/3/themes.html | |
"variables": { | |
"quick_panel_path_label_color":"#222", | |
"quick_panel_matched_label_color": "#022FDF", | |
"quick_panel_matched_path_label_color":"#111", | |
"quick_panel_selected_path_label_color": "#222", | |
"quick_panel_selected_matched_label_color": "#022FDF", |
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
#!/bin/bash | |
# Converts camelCased words into snake_cased ones. | |
# (This might be seful when you have to convert a JS object into an Elixir one.) | |
# TODO: Ignore quoted strings. | |
function camel_to_snake_case { | |
while read -r line; do | |
echo $line | sed 's/\(.\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]' | |
done | |
} |