Skip to content

Instantly share code, notes, and snippets.

View namor's full-sized avatar

John Wong namor

View GitHub Profile
@namor
namor / cto_line.pine
Created November 16, 2022 15:09 — forked from basnijholt/cto_line.pine
CTO Line indicator for TradingView
//@version=4
study(title="CTO Line", shorttitle="CTO", overlay=true, resolution="")
smma(src, length) =>
smma = 0.0
smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
smma
v1 = smma(hl2, 15)
m1 = smma(hl2, 19)
m2 = smma(hl2, 25)
v2 = smma(hl2, 29)
@namor
namor / capybara-helpers.rb
Created March 5, 2012 07:59 — forked from jc00ke/capybara-helpers.rb
Capybara helpers
def screenshot
require 'capybara/util/save_and_open_page'
now = Time.now
p = "/#{now.strftime('%Y-%m-%d-%H-%M-%S')}-#{rand}"
Capybara.save_page body, "#{p}.html"
path = Rails.root.join("#{Capybara.save_and_open_page_path}" "#{p}.png").to_s
page.driver.render path
Launchy.open path
end
@namor
namor / gist:1281716
Created October 12, 2011 16:24 — forked from SethWilson/gist:1277194
Installing Ruby 1.9.2 with rbenv
brew install --HEAD rbenv
brew install --HEAD ruby-build
brew install --HEAD https://raw.github.com/jasoncodes/homebrew/rbenv-vars/Library/Formula/rbenv-vars.rb # https://github.com/mxcl/homebrew/pull/7891
brew install readline
brew install ctags
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
echo 'gem() { rbenv exec gem "$@" && rbenv rehash && hash -r; }' >> ~/.bash_profile
exec
CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.2-p290
rbenv global 1.9.2-p290