source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
plessl/wkpdf
https://github.com/plessl/wkpdf
lib/controller.rb
Ruby
mit
184
master
7,780
require 'osx/cocoa' class Controller < NSObject include OSX attr_accessor :resourceCount, :webView def initWithWebView(webview) #super_init @resourceCount = 0 @saveTimer = nil @webView = webview log("initialized Controller\n") self end def webView_didFinishLoadForFrame(sender, fra...
github
plessl/wkpdf
https://github.com/plessl/wkpdf
test/rubycocoa/NSPrinterTest.rb
Ruby
mit
184
master
224
require 'osx/cocoa' include OSX #p = NSPrinter.printerTypes() p = NSPrinter.printerWithType("Generic PostScript Printer") puts "#{p}" size = p.pageSizeForPaper("A4") puts "size: width=#{size.width} height=#{size.height}"
github
plessl/wkpdf
https://github.com/plessl/wkpdf
scripts/mirror-and-convert.rb
Ruby
mit
184
master
317
#!/usr/bin/ruby URL = 'http://www.example.com' system("wget -E --mirror #{URL}") BASE_DIR = URL files = `find #{BASE_DIR} -name '*.html'` files.each { |source_file| source_file.chomp! dest_file = source_file.sub(/(.*)\.html?/, '\1.pdf') system("wkpdf --source #{source_file} --output #{dest_file} --format A5") }
github
opal/opal-jquery
https://github.com/opal/opal-jquery
Rakefile
Ruby
mit
184
master
2,549
require 'bundler' Bundler.require Bundler::GemHelper.install_tasks ENV['RUNNER'] = 'chrome' require 'opal/rspec/rake_task' Opal::RSpec::RakeTask.new(:default) do |server, task| server.index_path = 'spec-opal/jquery/index.html.erb' task.default_path = 'spec-opal' end Opal::RSpec::RakeTask.new(:jquery3) do |server...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
opal-jquery.gemspec
Ruby
mit
184
master
993
# -*- encoding: utf-8 -*- require File.expand_path('../lib/opal/jquery/version', __FILE__) Gem::Specification.new do |s| s.name = 'opal-jquery' s.version = Opal::JQuery::VERSION s.authors = ['Adam Beynon', 'Elia Schito', 'Andy Maleh'] s.email = 'elia@schito.me' s.homepage = 'http...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
Gemfile
Ruby
mit
184
master
518
source 'https://rubygems.org' gemspec case (opal_version = ENV['OPAL_VERSION']) when 'master' gem 'opal', github: 'opal/opal', branch: 'master' gem 'opal-sprockets', github: 'opal/opal-sprockets' gem 'opal-rspec', github: 'opal/opal-rspec', branch: 'master', submodules: true when nil gem 'opal' # let bundler p...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
config.ru
Ruby
mit
184
master
312
require 'bundler' Bundler.require require 'opal/rspec' require 'opal/rspec/sprockets_environment' sprockets_env = Opal::RSpec::SprocketsEnvironment.new run Opal::Server.new(sprockets: sprockets_env) { |s| s.main = 'opal/rspec/sprockets_runner' sprockets_env.add_spec_paths_to_sprockets s.debug = false }
github
opal/opal-jquery
https://github.com/opal/opal-jquery
examples/rake/Rakefile
Ruby
mit
184
master
229
require 'bundler' Bundler.require desc "Build to application.js" task :build do File.open("application.js", "w+") do |out| env = Opal::Environment.new env.append_path "app" out << env["application"].to_s end end
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery.rb
Ruby
mit
184
master
325
if RUBY_ENGINE == 'opal' require 'opal/jquery/window' require 'opal/jquery/document' require 'opal/jquery/element' require 'opal/jquery/event' require 'opal/jquery/http' require 'opal/jquery/kernel' else require 'opal' require 'opal/jquery/version' Opal.append_path File.expand_path('../..', __FILE__)...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/http.rb
Ruby
mit
184
master
7,143
# backtick_javascript: true require 'json' require 'native' require 'promise' require 'opal/jquery/constants' # {HTTP} is used to perform a `XMLHttpRequest` in ruby. It is a simple wrapper # around jQuerys' `$.ajax` call. `XMLHttpRequest` is not wrapped directly as # jquery provides some cross browser fixes. # # # Ma...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/local_storage.rb
Ruby
mit
184
master
2,633
# backtick_javascript: true module Browser # {Browser::LocalStorage} is a simple wrapper around `localStorage` in the # browser. # # Instead of using the class directly, the main instance {LocalStorage} # should be used instead. This class can be used to wrap an instance from # another window or iframe if ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/kernel.rb
Ruby
mit
184
master
241
# backtick_javascript: true module Kernel # Alert the given message using `window.alert()`. This is a blocking # method. # # @param msg [String] message to alert # @return [nil] def alert(msg) `alert(msg)` nil end end
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/rspec.rb
Ruby
mit
184
master
1,948
module Browser # When testing (using rspec), this module provides some helper methods to # try and make testing a little easier. # # ## Usage # # Simply require this file somewher (usualy in `spec_helper.rb`): # # require 'application' # require 'opal-rspec' # require 'opal/jquery/rspec'...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/event.rb
Ruby
mit
184
master
4,758
# backtick_javascript: true require 'opal/jquery/constants' # {Event} wraps native jQuery events into a ruby api. Instances of events # can be accessed by {#to_n}. # # {Event} instances should not be created directly, as they are usually # created by one of the dom event handlers in {Element}. # # element.on :cli...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/constants.rb
Ruby
mit
184
master
401
# backtick_javascript: true require 'native' unless defined?(JQUERY_CLASS) case when `!!Opal.global.jQuery` JQUERY_CLASS = JQUERY_SELECTOR = `Opal.global.jQuery` when `!!Opal.global.Zepto` JQUERY_SELECTOR = `Opal.global.Zepto` JQUERY_CLASS = `Opal.global.Zepto.zepto.Z` else raise NameError, "C...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/element.rb
Ruby
mit
184
master
18,833
# backtick_javascript: true require 'native' require 'opal/jquery/constants' # {Element} is a toll-free bridged class that maps to native jQuery instances. # # As {Element} maps to a jQuery object, it can be used to represent 0, 1, or # more actual DOM elements. {Element} exposes a more ruby-esqe interface to # jQuer...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/document.rb
Ruby
mit
184
master
3,176
# backtick_javascript: true require 'opal/jquery/constants' require 'opal/jquery/element' module Browser # {Document} includes these methods to extend {Element}. # # Generally, you will want to use the {::Document} top level instance of # {Element}. # # ## Usage # # A useful method on {Document} is th...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
lib/opal/jquery/window.rb
Ruby
mit
184
master
1,081
# backtick_javascript: true require 'opal/jquery/element' module Browser # {Window} instances are {Native} objects used to wrap native window instances. # # Generally, you will want to use the top level {::Window} instance, which # wraps `window` from the main page. class Window # In more recent Opal ve...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/kernel_spec.rb
Ruby
mit
184
master
365
require 'spec_helper' RSpec.describe 'Kernel#alert' do it 'returns nil' do begin original_alert = `window.alert` message = nil `window.alert = function(string) { message = string; }` Kernel.alert('a message').should be_nil expect(message).to eq('a message') ensure `window....
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/http_spec.rb
Ruby
mit
184
master
2,504
require "spec_helper" RSpec.describe HTTP do let(:good_url) { '/spec/fixtures/simple.txt' } let(:json_url) { '/spec/fixtures/user.json' } let(:bad_url) { '/spec/fixtures/does_not_exist.txt' } describe ".setup" do it 'presents the $.ajaxSetup() object as a Hash' do expect(HTTP.setup).to be_a Hash ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/spec_helper.rb
Ruby
mit
184
master
404
require 'jquery/jquery-1.8.3' require 'opal-rspec' require 'opal/jquery' require 'opal/jquery/rspec' module JQueryTestHelpers def find(selector) Element.find selector end end module SkipAsync def async(*args, &block) xit(*args, &block) end end RSpec.configure do |config| config.include JQueryTestHe...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element_spec.rb
Ruby
mit
184
master
6,974
require "spec_helper" RSpec.describe Element do context 'events' do html <<-HTML <div id="foo"> <div id="bar" class="apples"></div> </div> <div id="baz"></div> HTML describe '#on' do it 'adds an event listener onto the elements' do count = 0 foo = Elemen...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/local_storage_spec.rb
Ruby
mit
184
master
485
require 'spec_helper' require 'opal/jquery/local_storage' RSpec.describe LocalStorage do before { subject.clear } it "returns nil for undefined values" do expect(subject['foo']).to be_nil end it "should be able to create items" do subject['foo'] = 'Ford Prefect' expect(subject['foo']).to eq('Ford...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/document_spec.rb
Ruby
mit
184
master
1,178
require 'spec_helper' RSpec.describe 'Document' do subject { Document } describe "ready?" do it "accepts a block" do Document.ready? { puts `$.fn.jquery` } end it "accepts a block" do Document.ready? { } end end describe "ready" do p self.ancestors async "re...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/event_spec.rb
Ruby
mit
184
master
1,302
require "spec_helper" RSpec.describe Event do html <<-HTML <div id="on-spec"> <div id="foo"> <div id="bar"></div> </div> <div id="baz"></div> </div> HTML it '#current_target returns the current element in the bubbling' do foo = Element['#foo'] bar = Element['#bar'] ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/to_s_spec.rb
Ruby
mit
184
master
398
require "spec_helper" RSpec.describe "Element#to_s" do html <<-HTML <div id="foo">hi</div> <div class="bar"></div> <p id="lol" class="bar"></div> HTML it "returns a string representation of the elements" do Element.find('#foo').to_s.should == '<div id="foo">hi</div>' Element.find('.bar').to_...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/css_spec.rb
Ruby
mit
184
master
1,279
require "spec_helper" RSpec.describe "Element#css" do html <<-HTML <div id="foo" style="background-color:rgb(15,99,30); color:;"></div> <div id="bar"></div> <div id="hash"></div> HTML describe "with a given name" do it "returns the value of the CSS property for the given name" do Element.f...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/method_missing_spec.rb
Ruby
mit
184
master
918
require "spec_helper" RSpec.describe "Element#method_missing" do context 'with missing property' do html %{<div id="foo" class="bar"></div>} it 'fallsback on method_missing when a method is unknown' do expect(Element['#foo']).to respond_to(:offsetParent) expect(Element['#foo'].offsetParent).to e...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/append_spec.rb
Ruby
mit
184
master
755
require "spec_helper" RSpec.describe "Element#append" do html <<-HTML <div id="foo" class="first-append"></div> <div id="bar" class="first-append"></div> <div id="baz"></div> <div id="buz"></div> HTML it "should insert the HTML string to the end of each element" do Element.find('.first-appen...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/after_spec.rb
Ruby
mit
184
master
711
require 'spec_helper' RSpec.describe 'Element#after' do html <<-HTML <div id="some-header" class="kapow"></div> <div id="foo" class="after-spec-first"></div> <div id="bar" class="after-spec-first"></div> <div id="baz"></div> HTML it 'should insert the given html string after each element' do ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/traversing_spec.rb
Ruby
mit
184
master
4,398
require "spec_helper" RSpec.describe Element do before do @div = Element.parse <<-HTML <div id="traversing-spec"> <div id="foo" class="traversing-class"></div> <div id="bar" class="traversing-class"> <p>Hey</p> <p>There</p> </div> <div id="baz" class="mai...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/animations_spec.rb
Ruby
mit
184
master
1,636
require "spec_helper" RSpec.describe "Element animation methods" do html <<-HTML <div id="animate-foo"></div> HTML describe "#animate" do ### HACKY # jQUery's animate method doesn't *always* finish on time # so the values are being compared using greater than async "should animate a set of ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/class_name_spec.rb
Ruby
mit
184
master
1,935
require "spec_helper" RSpec.describe "Element#class_name" do html <<-HTML <div id="foo" class="whiskey"></div> <div id="bar" class="scotch brandy"></div> <div id="baz" class=""></div> <div id="buz"></div> <div class="red dark"></div> <div class="red light"></div> HTML it "should return ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/expose_spec.rb
Ruby
mit
184
master
2,526
require "spec_helper" RSpec.describe "Element#expose" do subject(:element) { Element.new } before do `$.fn.exposableMethod = function() {return 123}` `$.fn.exposableMethod2 = function() {return 12}` `$.fn.opal_specs_extension = function() {return "foo_bar_baz";};` `$.fn.opal_specs_args = function()...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/inspect_spec.rb
Ruby
mit
184
master
949
require "spec_helper" RSpec.describe "Element#inspect" do html <<-HTML <div id="foo"></div> <div class="bar"></div> <p id="lol" class="bar"></div> HTML it "returns a string representation of the elements" do Element.find('#foo').inspect.should == '#<Element [<div id="foo">]>' Element.find('....
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/display_spec.rb
Ruby
mit
184
master
910
require "spec_helper" RSpec.describe "Element display methods" do html <<-HTML <div id="shown"></div> <div id="hidden" style="display: none"></div> HTML it "hides an element" do element = Element.find('#shown') element.css('display').should == 'block' element.hide element.css('display')....
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/height_width_spec.rb
Ruby
mit
184
master
1,118
require "spec_helper" RSpec.describe "Element height and width" do html <<-HTML <div id="dimensions" style='width: 100px; height: 200px'></div> HTML describe '#height' do it "should grab height of existing element" do elm = Element.id('dimensions') expect(elm.height).to eq(200) end ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/attributes_spec.rb
Ruby
mit
184
master
6,443
require "spec_helper" RSpec.describe Element do html <<-HTML <div id="foo"></div> <div id="bar" class="apples"></div> <div id="baz" class="lemons"></div> <div id="attr-foo" title="Hello there!"></div> <div id="attr-bar"></div> <div id="attr-baz" title=""></div> <div id="attr-woosh"></div...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/at_spec.rb
Ruby
mit
184
master
765
require "spec_helper" RSpec.describe "Element#at" do html <<-HTML <div class="foo" id="blah"></div> <div class="foo" id="bleh"></div> <div class="foo" id="bluh"></div> HTML it "returns the element at the given index" do foos = Element.find '.foo' foos.length.should == 3 foos.at(0).id.sh...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/iterable_spec.rb
Ruby
mit
184
master
1,330
require "spec_helper" RSpec.describe Element do html <<-HTML <table class="players"> <tr class="player"> <td class="name">mario</td> <td class="surname">rossi</td> </tr> <tr class="player"> <td class="name">paolo</td> <td class="surname">bianchi</td> </tr> </table> HTML ...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/before_spec.rb
Ruby
mit
184
master
748
require "spec_helper" RSpec.describe "Element#before" do html <<-HTML <div id="some-header" class="kapow"></div> <div id="foo" class="before-spec-first"></div> <div id="bar" class="before-spec-first"></div> <div id="baz"></div> HTML it "should insert the given html string before each element" do...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/append_to_spec.rb
Ruby
mit
184
master
531
require "spec_helper" RSpec.describe "Element#append_to" do html <<-HTML <div id="foo"></div> <div id="bar"></div> <div id="baz"></div> HTML it "should insert the receiver into the target element" do Element.find('#foo').children.size.should == 0 Element.parse('<ul class="kapow"></ul>').app...
github
opal/opal-jquery
https://github.com/opal/opal-jquery
spec-opal/element/prepend_spec.rb
Ruby
mit
184
master
471
require 'spec_helper' RSpec.describe 'Element#prepend' do html <<-HTML <div id="foo"></div> <div id="bar"> <p>Something</p> </div> HTML it 'inserts the given html to beginning of element' do foo = Element.find '#foo' bar = Element.find '#bar' foo.prepend '<span>Bore Da</span>' ...
github
ddollar/heroku-sql-console
https://github.com/ddollar/heroku-sql-console
heroku-sql-console.gemspec
Ruby
mit
184
master
876
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "heroku-sql-console/version" Gem::Specification.new do |s| s.name = "heroku-sql-console" s.version = Heroku::Command::Sql::VERSION s.platform = Gem::Platform::RUBY s.authors = ["David Dollar", "Terence Lee"] s.em...
github
ddollar/heroku-sql-console
https://github.com/ddollar/heroku-sql-console
lib/heroku/command/sql.rb
Ruby
mit
184
master
1,603
# SQL console like for your heroku app's database class Heroku::Command::Sql < Heroku::Command::BaseWithApp # sql # # access the sql console for your datasabe # def index database_url = heroku.config_vars(app)['DATABASE_URL'] sqlconsole_history_read(app) display "SQL console for #{app}.#{heroku...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
dokku-cli.gemspec
Ruby
mit
184
master
863
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'dokku_cli/version' Gem::Specification.new do |spec| spec.name = "dokku-cli" spec.version = DokkuCli::VERSION spec.authors = ["Sebastian Szturo"] spec.email = ...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli.rb
Ruby
mit
184
master
3,612
require 'thor' require "dokku_cli/version" require "dokku_cli/config" require "dokku_cli/domains" require "dokku_cli/nginx" require "dokku_cli/ps" require "dokku_cli/events" require "dokku_cli/certs" require "dokku_cli/keys" module DokkuCli class Cli < Thor class_option :remote desc "logs [-n num] [-p ps] ...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/ps.rb
Ruby
mit
184
master
1,039
module DokkuCli class Cli < Thor map "ps:rebuild" => "ps_rebuild", "ps:restart" => "ps_restart", "ps:start" => "ps_start", "ps:stop" => "ps_stop", "ps:scale" => "ps_scale" desc "ps", "List processes running in app container(s)" def ps run_command "ps #{app_name}" ...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/keys.rb
Ruby
mit
184
master
386
module DokkuCli class Cli < Thor map "keys:add" => "keys_add" desc "keys:add PATH DESCRIPTION", "Add the ssh key to your dokku machine." def keys_add(path, description) command = "cat #{path} | ssh -p #{port} root@#{domain} 'sudo sshcommand acl-add dokku #{description}'" puts "Adding #{path...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/events.rb
Ruby
mit
184
master
627
module DokkuCli class Cli < Thor map "events:list" => "events_list", "events:on" => "events_on", "events:off" => "events_off" desc "events", "Show the last events (-t follows)" def events run_command "events #{app_name}" end desc "events:list", "List logged events" def...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/domains.rb
Ruby
mit
184
master
783
module DokkuCli class Cli < Thor map "domains:add" => "domains_add", "domains:clear" => "domains_clear", "domains:remove" => "domains_remove" desc "domains", "List custom domains for the app" def domains run_command "domains #{app_name}" end desc "domains:add DOMAIN", "Add...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/nginx.rb
Ruby
mit
184
master
653
module DokkuCli class Cli < Thor map "nginx:build" => "nginx_build", "nginx:access-logs" => "nginx_access_logs", "nginx:error-logs" => "nginx_error_logs" desc "nginx:build", "(Re)builds nginx config for the app" def nginx_build run_command "nginx:build-config #{app_name}" end ...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/certs.rb
Ruby
mit
184
master
1,148
module DokkuCli class Cli < Thor map "certs:add" => "certs_add", "certs:generate" => "certs_generate", "certs:info" => "certs_info", "certs:remove" => "certs_remove", "certs:update" => "certs_update" desc "certs:add CRT KEY", "Add an ssl endpoint to an app. Can also import fr...
github
SebastianSzturo/dokku-cli
https://github.com/SebastianSzturo/dokku-cli
lib/dokku_cli/config.rb
Ruby
mit
184
master
2,266
module DokkuCli class Cli < Thor map "config:get" => "config_get", "config:set" => "config_set", "config:unset" => "config_unset", "config:set:file" => "config_set_file" desc "config", "Display the app's environment variables" def config run_command "config #{app_name}" ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
govkit.gemspec
Ruby
mit
183
master
5,689
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "govkit" s.version = "0.7.4" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
Rakefile
Ruby
mit
183
master
3,392
require 'rubygems' require 'rake' require 'rake/rdoctask' begin require 'rspec/core/rake_task' rescue LoadError begin gem 'rspec-rails', '>= 2.0.0' require 'rspec/core/rake_task' rescue LoadError puts "[govkit:] RSpec - or one of it's dependencies - is not available. Install it with: sudo gem install...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
Gemfile
Ruby
mit
183
master
315
source 'http://rubygems.org' gem "i18n" gem "activesupport", :require => 'active_support' gem "nokogiri", '~> 1.5.5' gem "httparty", '>= 0.7.4' gem "json", '>= 1.4.3' gem "fastercsv", '>= 1.5.3' group :development do gem "jeweler" gem "rake" end group :test do gem "rake" gem "rspec" gem "fakeweb" end
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit.rb
Ruby
mit
183
master
1,538
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) require 'csv' require 'digest/md5' require 'json' require 'open-uri' if RUBY_VERSION[0,3] == "1.8" require 'fastercsv' end require 'nokogiri' require 'httparty' # String#singularize in...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_states.rb
Ruby
mit
183
master
3,875
module GovKit # Parent class for OpenStates resources # See http://openstates.sunlightlabs.com/api/ class OpenStatesResource < Resource base_uri GovKit::configuration.openstates_base_url # Do a GET query, with optional parameters. # # OpenStates returns a 404 error when a query # returns not...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/search_engines.rb
Ruby
mit
183
master
321
module GovKit::SearchEngines autoload :GoogleNews, 'gov_kit/search_engines/google_news' autoload :GoogleBlog, 'gov_kit/search_engines/google_blog' autoload :Technorati, 'gov_kit/search_engines/technorati' autoload :Bing, 'gov_kit/search_engines/bing' autoload :Wikipedia, 'gov_kit/search_engines/wikipedia' end
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/follow_the_money.rb
Ruby
mit
183
master
6,569
module GovKit # Subclass of {Resource} for FollowTheMoney data. This # is subclassed further for each of the different types of record # returned by FollowTheMoney. # # For the details on the FollowTheMoney queries, see {http://www.followthemoney.org/services/methods.phtml the FollowTheMoney API documentati...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress.rb
Ruby
mit
183
master
4,436
require 'nokogiri' require 'open-uri' require 'json' require 'cgi' module GovKit::OpenCongress autoload :Bill, 'gov_kit/open_congress/bill' autoload :BlogPost, 'gov_kit/open_congress/blog_post' autoload :NewsPost, 'gov_kit/open_congress/news_post' autoload :VotingComparison, ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/railtie.rb
Ruby
mit
183
master
605
module GovKit if defined? Rails::Railtie require 'rails' class Railtie < Rails::Railtie initializer 'govkit.insert_into_active_record' do ActiveSupport.on_load :active_record do GovKit::Railtie.insert end end end end # This class exists in order to run its insert...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/vote_smart.rb
Ruby
mit
183
master
7,382
module GovKit class VoteSmartResource < Resource default_params :o => 'JSON', :key => GovKit::configuration.votesmart_apikey base_uri GovKit::configuration.votesmart_base_url end module VoteSmart class State < VoteSmartResource def self.find_all response = get("/State.getStateIDs") ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/acts_as_noteworthy.rb
Ruby
mit
183
master
2,175
module GovKit::ActsAsNoteworthy def self.included(base) base.extend ActMethods end # Module to make a rails model act as a noteworthy object, linking it to govkit's mention model module ActMethods # Sets up the relationship between the model and the mention model # # @param [Hash] opts a hash...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/configuration.rb
Ruby
mit
183
master
2,136
module GovKit class Configuration attr_accessor :sunlight_apikey, :openstates_base_url, :transparency_data_base_url, :transparency_data_categories_url attr_accessor :votesmart_apikey, :votesmart_base_url attr_accessor :openstates_apikey, :ftm_apikey, :ftm_base_url attr_accessor :opencongress_apikey, :...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/resource.rb
Ruby
mit
183
master
6,157
module GovKit # This is the parent class for the classes that wrap # the data returned to govkit. # # Subclasses are responsible for fetching the data from # different web services; Resource will then parse the returned data, # converting returned fields to instance methods. # # Initialize a Resource...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/transparency_data.rb
Ruby
mit
183
master
5,589
module GovKit class TransparencyDataResource < Resource # default_params and base_uri are provided by HTTParty default_params :apikey => GovKit::configuration.sunlight_apikey base_uri GovKit::configuration.transparency_data_base_url def self.search_for( path, ops={} ) response = get(path, :que...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/roll_call.rb
Ruby
mit
183
master
396
module GovKit module OpenCongress class RollCall < OpenCongressObject attr_accessor :abstains, :presents, :roll_type, :title, :question, :republican_position, :democratic_position, :amendment_id, :ayes, :nays, :bill, :date, :number, :id, :required, :where def initializ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/voting_comparison.rb
Ruby
mit
183
master
1,023
module GovKit module OpenCongress class VotingComparison < OpenCongressObject attr_accessor :total_votes, :same_vote, :percentage, :person1, :person2, :shared_committees, :hot_votes, :other_votes def initialize(params) super VotingComparison, params ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/bill.rb
Ruby
mit
183
master
4,509
module GovKit module OpenCongress class Bill < OpenCongressObject attr_accessor :bill_type, :id, :introduced, :last_speech, :last_vote_date, :last_vote_roll, :last_vote_where, :last_action, :number, :plain_language_summary, :session, :sponsor, :co_sponsors, :title_full_common, :status, :most_recent_actions,...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/person.rb
Ruby
mit
183
master
3,818
module GovKit module OpenCongress class Person < OpenCongressObject attr_accessor :firstname, :lastname, :bioguideid, :birthday, :district, :email, :gender, :id, :metavid_id, :middlename, :name, :nickname, :osid, :party, :religion, :state, :title, :unaccented_name, :url, :user_ap...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/person_stat.rb
Ruby
mit
183
master
651
module GovKit module OpenCongress class PersonStat < OpenCongressObject attr_accessor :votes_most_often_with_id, :opposing_party_votes_most_often_with_id, :votes_least_often_with_id, :same_party_votes_least_often_with_id, :party_votes_percentage, :abstains_percentage, :abstains_percentage_rank, :party_...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/roll_call_comparison.rb
Ruby
mit
183
master
528
module GovKit module OpenCongress class RollCallComparison < OpenCongressObject attr_accessor :roll_call, :person1, :person2 def initialize(params) super RollCallComparison, params set_people set_roll_call end def set_people se...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/news_post.rb
Ruby
mit
183
master
276
module GovKit module OpenCongress class NewsPost < OpenCongressObject attr_accessor :title, :date, :url, :source_url, :excerpt, :source, :average_rating def initialize(params) super NewsPost, params end end end end
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/open_congress/blog_post.rb
Ruby
mit
183
master
277
module GovKit module OpenCongress class BlogPost < OpenCongressObject attr_accessor :title, :date, :url, :source_url, :excerpt, :source, :average_rating def initialize(params) super BlogPost, params end end end end
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/search_engines/google_blog.rb
Ruby
mit
183
master
978
module GovKit module SearchEngines class GoogleBlog def self.search(query=[], options = {}) query = [query, options[:geo]].compact.join('+') host = GovKit::configuration.google_blog_base_url path = "/blogsearch_feeds?q=#{URI::encode(query)}&hl=en&output=rss&num=50" doc = Nok...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/search_engines/bing.rb
Ruby
mit
183
master
1,088
module GovKit module SearchEngines class Bing def self.search(query=[], options={}) host = GovKit::configuration.bing_base_url query = [query, options[:geo]].compact.join('+') options['Sources'] ||= 'news' path = "/json.aspx?Query=#{URI::encode(query)}&AppId=#{GovKit::confi...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/search_engines/wikipedia.rb
Ruby
mit
183
master
668
module GovKit module SearchEngines class Wikipedia include HTTParty default_params :format => 'xml' base_uri GovKit::configuration.wikipedia_base_url headers 'User-Agent' => 'GovKit +http://github.com/opengovernment/govkit' def self.search(query, options={}) doc = Nokogiri::...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/search_engines/google_news.rb
Ruby
mit
183
master
1,482
module GovKit module SearchEngines # Class to wrap access to Google News. class GoogleNews # Fetches stories about a topic from google news. # Returns an array of GovKit::Mention objects. # # query: The query wanted For example: # mentions = GoogleNews.search("Nancy Pelosi") ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/gov_kit/search_engines/technorati.rb
Ruby
mit
183
master
1,063
module GovKit module SearchEngines class Technorati def self.search(options=[]) query = options.to_query('q') host = GovKit::configuration.technorati_base_url path = "/search?key=#{GovKit::configuration.technorati_apikey}&limit=50&language=en&query=#{URI::encode(query)}" doc...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/generators/govkit/govkit_generator.rb
Ruby
mit
183
master
678
require 'rails/generators' # Generator to setup rails app for using GovKit class GovkitGenerator < Rails::Generators::Base def initialize(*runtime_args) super end desc "Copies files necessary to use govkit" source_root File.join(File.dirname(__FILE__), 'templates') # Copies the files necessary to u...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/generators/govkit/templates/create_mentions.rb
Ruby
mit
183
master
553
class CreateMentions < ActiveRecord::Migration def self.up create_table :mentions, :force => true do |t| t.string "url", :limit => 8000 t.string "excerpt", :limit => 4000 t.string "title", :limit => 1000 t.string "source" t.datetime "date" t.floa...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/generators/govkit/templates/mention.rb
Ruby
mit
183
master
445
# A model to contain mentions of the :owner in the media class Mention < ActiveRecord::Base belongs_to :owner, :polymorphic => true scope :since, lambda { |d| where(["mentions.date > ?", d]) } # Returns the mentions in JSON form # # @params [Hash] A hash of options # @return The mentions in JSON form d...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
lib/generators/govkit/templates/govkit.rb
Ruby
mit
183
master
801
if defined? GovKit GovKit.configure do |config| # Get an API key for Sunlight's Open States project here: # http://services.sunlightlabs.com/accounts/register/ config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY' ##API key for Votesmart # http://votesmart.org/services_api.php config.votesmart_api...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
generators/govkit/govkit_generator.rb
Ruby
mit
183
master
663
class GovkitGenerator < Rails::Generator::Base def initialize(*runtime_args) super end def manifest record do |m| m.directory File.join('config', 'initializers') m.template 'govkit.rb', File.join('config', 'initializers', 'govkit.rb') m.directory File.join('app', 'models') m.te...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
spec/open_congress_spec.rb
Ruby
mit
183
master
3,191
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module GovKit::OpenCongress describe GovKit::OpenCongress do before(:all) do @oc_objs = [Bill, Person] unless FakeWeb.allow_net_connect? base_uri = "http://api.opencongress.org/" urls = [ [ "people?format=jso...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
spec/search_engines_spec.rb
Ruby
mit
183
master
1,349
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module GovKit::SearchEngines describe GovKit::SearchEngines do before(:all) do unless FakeWeb.allow_net_connect? google_news_uri = "http://news.google.com/" urls = [ [ "news?q=congress&output=rss&num=50", "google_ne...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
spec/spec_helper.rb
Ruby
mit
183
master
1,413
require 'rubygems' require 'rspec' require 'fakeweb' require File.dirname(__FILE__) + '/../lib/govkit' # Set to true to run tests against the live URLs, and add the following to # spec/support/api_keys.rb: # # unless FakeWeb.allow_net_connect? # GovKit.configure do |config| # config.sunlight_apikey ...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
spec/follow_the_money_spec.rb
Ruby
mit
183
master
2,128
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module GovKit::FollowTheMoney describe GovKit::FollowTheMoney do before(:all) do unless FakeWeb.allow_net_connect? base_uri = GovKit::FollowTheMoneyResource.base_uri.gsub(/\./, '\.') urls = [ ['/base_level\.indust...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
spec/transparency_data_spec.rb
Ruby
mit
183
master
5,652
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module GovKit::TransparencyData describe GovKit::TransparencyData do before(:all) do unless FakeWeb.allow_net_connect? base_uri = GovKit::TransparencyDataResource.base_uri.gsub(/\./, '\.') urls = [ ['/contribution...
github
opengovernment/govkit
https://github.com/opengovernment/govkit
spec/open_states_spec.rb
Ruby
mit
183
master
6,833
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module GovKit::OpenStates describe GovKit::OpenStates do before(:all) do unless FakeWeb.allow_net_connect? base_uri = GovKit::OpenStatesResource.base_uri.gsub(/\./, '\.') # @todo The fixtures are out-of-date. urls = ...
github
mgsnova/feature
https://github.com/mgsnova/feature
Gemfile
Ruby
mit
183
master
269
source 'https://rubygems.org' gem 'rake' group :test do gem 'coveralls', require: false gem 'fakeredis' gem 'rspec' gem 'rspec-mocks' gem 'rubocop', require: false gem 'timecop' if RUBY_VERSION >= '2.1' gem 'mutant' gem 'mutant-rspec' end end
github
mgsnova/feature
https://github.com/mgsnova/feature
feature.gemspec
Ruby
mit
183
master
439
require 'rubygems/package_task' Gem::Specification.new do |s| s.name = 'feature' s.version = '1.4.0' s.authors = ['Markus Gerdes'] s.email = 'github@mgsnova.de' s.homepage = 'http://github.com/mgsnova/feature' s.require_paths = ['lib'] s.summary = 'Feature Toggle library for ruby' s.files = FileList[...
github
mgsnova/feature
https://github.com/mgsnova/feature
Rakefile
Ruby
mit
183
master
468
require 'rake/testtask' require 'rspec/core/rake_task' require 'rubocop/rake_task' RuboCop::RakeTask.new RSpec::Core::RakeTask.new(:spec) do |spec| spec.pattern = 'spec/**/*_spec.rb' spec.rspec_opts = ['--colour', '-f documentation', '--backtrace'] end task :mutant do require 'mutant' result = Mutant::CLI.ru...
github
mgsnova/feature
https://github.com/mgsnova/feature
lib/feature.rb
Ruby
mit
183
master
3,436
# Feature module provides all methods # - to set a feature repository # - to check if a feature (represented by a symbol) is active or inactive # - for conditional block execution with or without a feature # - to refresh the feature lists (request them from repository) # # @note all features not active will be handled ...
github
mgsnova/feature
https://github.com/mgsnova/feature
lib/feature/testing.rb
Ruby
mit
183
master
1,553
require 'feature' # This file provides functionality for testing your code with features # activated or deactivated. # This file should only be required in test/spec code! # # To enable Feature testing capabilities do: # require 'feature/testing' module Feature # Execute the code block with the given features acti...
github
mgsnova/feature
https://github.com/mgsnova/feature
lib/feature/repository.rb
Ruby
mit
183
master
297
module Feature # Module for holding feature repositories module Repository require 'feature/repository/simple_repository' require 'feature/repository/yaml_repository' require 'feature/repository/active_record_repository' require 'feature/repository/redis_repository' end end
github
mgsnova/feature
https://github.com/mgsnova/feature
lib/feature/generators/install_generator.rb
Ruby
mit
183
master
948
if defined?(Rails) && Rails::VERSION::STRING > '3' require 'rails/generators' module Feature # Rails generator for generating feature ActiveRecord model # and migration step for creating the table class InstallGenerator < Rails::Generators::Base desc 'This generator creates a migration and a mode...
github
mgsnova/feature
https://github.com/mgsnova/feature
lib/feature/repository/redis_repository.rb
Ruby
mit
183
master
2,175
module Feature module Repository # RedisRepository for active feature list # # Example usage: # repository = RedisRepository.new("feature_toggles") # repository.add_active_feature(:feature_name) # # 'feature_toggles' can be whatever name you want to use for # the Redis hash that wi...