Skip to content

Instantly share code, notes, and snippets.

View papriwalprateek's full-sized avatar

Prateek Papriwal papriwalprateek

View GitHub Profile
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go"
class Entity
include Mongoid::Document
field :type, type: String
field :addr, type: String
end
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause this
# file to always be loaded, without a need to explicitly require it in any files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, make a
# separate helper file that requires this one and then use it only in the specs
# entity_spec.rb
require "spec_helper"
require '/home/papri/dqalpha/app/models/entity'
describe Entity do
it "equates output from old entity to new entity" do
ext_wiki = Entity.find_by(name_ref:"extraction for wikipedia")
ext_wiki1 = Entity.find_by(name_ref:"extraction for wikipedia")
head = <<HTML
<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<script type='text/x-mathjax-config'>
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
<script type='text/javascript'
src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'>
</script>
</head>
HTML
All of these are present in Vega.
choropleth
grouped_bar
error
force
image
jobs
lifelines
map
class display_vega(vis)
display(HTML('''<script src="http://d3js.org/d3.v3.min.js"></script>'''))
display(HTML('''<script src="http://trifacta.github.com/vega/vega.js"></script>'''))
a = HTML('''<div id="vis"></div>''')
b = Javascript('''vg.parse.spec(%s, function(chart) { chart({el:"#vis"}).update(); });''' % (vis.to_json()))
display(a, b)
x = [0,1,2,3]
y = [0,1,4,9]
Plotrb::Simple.scatter(x,y) # This method has been implemented in plotrb already
bar = Plotrb::Simple.bar([1,2,4,9,16])
# Easy method for setting axis
--> bar.axis_titles(x='Index', y='Value')
ArgumentError: Duplicate names for Data object
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/data.rb:80:in `process_name'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/data.rb:68:in `attribute_post_processing'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/base.rb:65:in `collect_attributes'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/base.rb:75:in `block (2 levels) in collect_attributes'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/base.rb:74:in `collect'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/base.rb:74:in `block in collect_attributes'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/base.rb:67:in `each'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb/base.rb:67:in `collect_attributes'
from /home/papri/.rvm/gems/ruby-2.1.0-preview2/gems/plotrb-0.0.1/lib/plotrb
papri@papri-HP-Pavilion-dv6-Notebook-PC:~/Downloads/git_work/dqalpha$ irb
1.9.3p484 :001 > gem 'plotrb'
=> true
1.9.3p484 :002 > require 'plotrb'
LoadError: cannot load such file -- plotrb
from /home/papri/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from /home/papri/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from (irb):2
from /home/papri/.rvm/rubies/ruby-1.9.3-p484/bin/irb:12:in `<main