Skip to content

Instantly share code, notes, and snippets.

View jrunning's full-sized avatar

Jordan Running jrunning

View GitHub Profile
@jrunning
jrunning / functions.sh
Last active July 18, 2018 17:03 — forked from junegunn/functions.sh
Key bindings for git with fzf (https://junegunn.kr/2016/07/fzf-git/)
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% "$@" --border
}
@jrunning
jrunning / 01_mustache_liquid_benchmark.rb
Last active March 27, 2022 23:09 — forked from anonymous/01_mustache_liquid_benchmark.rb
Mustache vs. Liquid templates benchmark (naïve)
# 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"
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) }
#!/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
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