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 heart FZF | |
# ------------- | |
is_in_git_repo() { | |
git rev-parse HEAD > /dev/null 2>&1 | |
} | |
fzf-down() { | |
fzf --height 50% "$@" --border | |
} |
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
# This is a very basic benchmark of Mustache (1.0.2) vs. | |
# Liquid (3.0.6) rendering. It does two sets of benchmarks: One with | |
# "precompiled" templates (i.e. the Mustache::Template or | |
# Liquid::Template object is kept between runs) and one without (a new | |
# Template object is instantiated for each run). This benchmark tests | |
# a basic loop; no other features e.g. partials or conditionals | |
# are tested. | |
require "benchmark/ips" | |
require "mustache" |
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
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 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
#!/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 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
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 |