Skip to content

Instantly share code, notes, and snippets.

View johnschult's full-sized avatar

John Schult johnschult

  • Johns Creek, GA
View GitHub Profile
def extended_encode(data_arr, max_value)
# Douglas F Shearer 2007
# http://douglasfshearer.com/blog/ruby-google-charts-api-data-encoding
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.'.split(//)
data = ''
data_arr.each do |value|
if value.is_a?(Integer) && value >= 0
new_value = ((4095 * value.to_f / max_value.to_f).to_i)
sixtyfours = new_value/64
units = new_value%64
@johnschult
johnschult / git.rb
Created April 17, 2009 16:07
Returns the git tag that has the same hash as the head of the branch parameter
require 'rubygems'
require 'git'
module Git
class Lib
# finds a tag with the same hash as the specified branch's head (if any)
def tag_for_head(branch)
tag = nil
head_hash = command('show-ref', ['--hash', "#{branch}"])
command('show-ref', ['--tags']).each do |r|
#!/usr/local/bin/ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'atom/pub'
require 'htmlentities'
ENV['TZ'] = 'US/Eastern'
BASE_URL = "http://investorshub.advfn.com/boards/"
$ rvm --trace list rubies
grep: rvm\/bin:: No such file or directory
grep: trace: No such file or directory
+ [[ -z '' ]]
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
+ [[ 2 -gt 0 ]]
+ rvm_token=list
+ shift
$ set -x ; rvm --trace version
+ rvm --trace version
+ [[ ! -z \[\033[1;33m\]\W\[\033[0m\]$(parse_git_branch) ∴ ]]
+ export rvm_interactive=1
+ rvm_interactive=1
+ [[ -z '' ]]
+ trap 'rm -rf "$rvm_tmp_path/$$" >/dev/null 2>&1' 0 1 2 3 15
++ cat /Users/schulty/.rvm/lib/VERSION.yml
++ tail -n 3
++ sed 's/^.*: //g'
#!/usr/bin/ruby
#
# This script installs to /usr/local only. To install elsewhere you can just
# untar http://github.com/mxcl/homebrew/tarball/master anywhere you like.
#
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
# versions of OS X. I cannot verify that for sure, and it was tested on
database = begin
File.read(File.dirname(__FILE__) + '/config/database.yml').scan(/production.+?adapter\W+(\w+)/im).join
rescue
nil
end
case database
when /postgres/, /pg/
gem 'pg', :require => false
when /sqlite/

title: remark description: Introduce remark. name: inverse layout: true class: center, middle, inverse

#remark [ri-mahrk]

What is it and why should I be using it?

@johnschult
johnschult / bookmarklet
Last active August 29, 2015 13:59
Fixed X1 Send to TV bookmarklet JS to transform all YouTube URLs to use HD and auto play in full screen. The original JS only worked on m.youtube URLs and did not use HD or work correctly if you used the bookmarklet on your desktop.
javascript:(function()%7Bvar z%3Ddocument.createElement(%27script%27)%3Bz.src%3D%27https://gist.githubusercontent.com/johnschult/10974466/raw/9aa0dbaaed5cb2c0871766db461e280932f3f2fb/bookmarklet-tv.js%27%3Bdocument.body.appendChild(z)%3B%7D)()
@johnschult
johnschult / boxcast_origin_instance_info.rb
Last active August 29, 2015 14:02
EC2 show instance tags
require 'rubygems'
require 'aws-sdk'
LAYER = 'boxcast_origin'
STACK = 'dev.boxcast.com'
TAG_PREFIX = 'boxcast:origin'
ec2 = AWS::EC2.new()
boxcast_origin_instances = []