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 GetterSetterTest | |
constructor: (@_obj = null) -> | |
# nada | |
# 'obj' is defined via the prototype, the definition proxied through to | |
# 'Object.defineProperty'. Remember, the value of '@' is GetterSetterTest | |
# itself when used in the body of its class definition. | |
Object.defineProperty @prototype, 'obj' | |
get: -> @_obj | |
set: (value)-> @_obj = value * 2 |
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
#!/usr/bin/env ruby | |
module Spreadsheet | |
module ColumnNotation | |
Alphabet = Hash[ (?A..?Z).each_with_index.map {|chr,idx| [ idx + 1, chr ] } ] | |
def self.position_to_column_notation(num) | |
quotient, remainder = num.divmod(Alphabet.size) | |
if remainder == 0 |
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 'set' | |
require 'benchmark/ips' | |
def process_old(list) | |
list.join(" ").split.uniq | |
end | |
def process_set(list) | |
unique = Set.new | |
list.each {|str| unique.merge(str.split) } |
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
# GIT heart FZF | |
# ------------- | |
is_in_git_repo() { | |
git rev-parse HEAD > /dev/null 2>&1 | |
} | |
fzf-down() { | |
fzf --height 50% "$@" --border | |
} |