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 | obie/desiru | https://github.com/obie/desiru | lib/desiru/graphql/executor.rb | Ruby | mit | 90 | main | 4,153 | # frozen_string_literal: true
require 'graphql'
module Desiru
module GraphQL
# Custom GraphQL executor with batch loading support
class Executor
attr_reader :schema, :data_loader
def initialize(schema, data_loader: nil)
@schema = schema
@data_loader = data_loader || DataLoader.n... |
github | obie/desiru | https://github.com/obie/desiru | lib/desiru/graphql/batch_loader.rb | Ruby | mit | 90 | main | 2,695 | # frozen_string_literal: true
require 'graphql'
module Desiru
module GraphQL
# GraphQL-compatible batch loader that integrates with GraphQL's lazy execution
class BatchLoader < ::GraphQL::Dataloader::Source
def initialize(module_instance)
super()
@module_instance = module_instance
... |
github | obie/desiru | https://github.com/obie/desiru | lib/desiru/graphql/schema_generator.rb | Ruby | mit | 90 | main | 6,670 | # frozen_string_literal: true
require 'graphql'
require_relative 'data_loader'
require_relative 'batch_loader'
require_relative 'type_builder'
module Desiru
module GraphQL
# Generates GraphQL schemas from Desiru signatures
class SchemaGenerator
attr_reader :signatures, :modules, :data_loader
de... |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | config.ru | Ruby | mit | 90 | master | 246 | require 'rubygems'
require 'bundler'
Bundler.require
# Force the correct host
use Rack::CanonicalHost, ENV['CANONICAL_HOST'] if ENV['CANONICAL_HOST']
# Require application
$:.unshift 'lib'
require 'markdownr'
# Run!
run Markdownr::Application |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | Gemfile | Ruby | mit | 90 | master | 476 | source 'https://rubygems.org'
ruby '2.7.0'
# Simple routing
gem 'sinatra'
# Web server
gem 'puma'
# Use the right host
gem 'rack-canonical-host'
# Markdown -> HTML
gem 'redcarpet', require: false
# HTML -> Markdown
gem 'unmarkdown', require: false
# Code coloring
gem 'pygments.rb', require: false
# Utilities
ge... |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | test/test_helper.rb | Ruby | mit | 90 | master | 380 | require 'rubygems'
require 'bundler'
Bundler.require :test
require 'minitest/autorun'
$:.unshift 'lib'
require 'markdownr'
# Support files
Dir["#{File.expand_path(File.dirname(__FILE__))}/support/*.rb"].each do |file|
require file
end
module Markdownr
class Test < MiniTest::Test
include Rack::Test::Methods
... |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | test/api_test.rb | Ruby | mit | 90 | master | 1,204 | require 'test_helper'
class APITest < Markdownr::Test
def test_markdown_to_html
post '/api/v2/convert', 'Hello **world**.', {
'CONTENT_TYPE' => 'text/x-markdown',
'HTTP_ACCEPT' => 'text/html'
}
assert_equal '<p>Hello <strong>world</strong>.</p>', last_response.body
post '/api/v2/convert'... |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | lib/markdownr/application.rb | Ruby | mit | 90 | master | 1,737 | require 'sinatra'
module Markdownr
class Application < Sinatra::Application
include Parsing
DEFAULT_MARKDOWN = "Welcome to [Markdownr.com](http://markdownr.com). We hope you **really** enjoy using this.\n\nJust type some [markdown](http://daringfireball.net/projects/markdown) on the left and see it on the r... |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | lib/markdownr/renderer.rb | Ruby | mit | 90 | master | 281 | require 'redcarpet'
require 'pygments.rb'
module Markdownr
class Renderer < Redcarpet::Render::HTML
include Redcarpet::Render::SmartyPants
def block_code(code, language)
language ||= 'text'
Pygments.highlight(code, lexer: language.to_sym)
end
end
end |
github | soffes/markdownr.com | https://github.com/soffes/markdownr.com | lib/markdownr/parsing.rb | Ruby | mit | 90 | master | 756 | require 'redcarpet'
require 'unmarkdown'
module Markdownr
module Parsing
module_function
def markdown(text, options = {})
return '' unless text and text.length > 0
default_options = {
no_intra_emphasis: true,
tables: true,
fenced_code_blocks: true,
autolink: true... |
github | lodestone/kindle | https://github.com/lodestone/kindle | kindle.gemspec | Ruby | mit | 90 | master | 1,138 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require_relative "lib/kindle"
Gem::Specification.new do |s|
s.name = "kindle"
s.version = Kindle::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Matt Petty"]
s.email = ["matt@kizmeta.com"]
s.homepage =... |
github | lodestone/kindle | https://github.com/lodestone/kindle | Gemfile | Ruby | mit | 90 | master | 283 | source "http://rubygems.org"
# gem "gli"
# gem "sqlite3"
# gem "activerecord", "~>5.0.0"
# gem "nokogiri"
# gem "mechanize"
# gem "rainbow"
# gem "pry"
group :test, :development do
gem "cucumber", '~> 2'
gem "aruba"
gem "timecop"
gem 'cucumber-timecop', require: false
end |
github | lodestone/kindle | https://github.com/lodestone/kindle | features/support/highlight_steps.rb | Ruby | mit | 90 | master | 385 | require "kindle"
require 'cucumber/timecop'
Given(/^a database exists$/) do
Kindle::Models::Book.delete_all
Kindle::Models::Highlight.delete_all
book = Kindle::Models::Book.create! title: "Zen", author: "Monk", highlight_count: 1
highlight = book.highlights.create! highlight: "Reach for enlightenment"
end
Giv... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle.rb | Ruby | mit | 90 | master | 734 | require "active_record"
require_relative "kindle/settings"
require_relative "kindle/migrations/initializer"
require_relative "kindle/migrations/base_migration"
require_relative "kindle/models/highlight"
require_relative "kindle/models/book"
require_relative "kindle/parser/agent"
require_relative "kindle/parser/annotati... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/cli.rb | Ruby | mit | 90 | master | 3,845 | require_relative "../kindle"
require "pry"
require "gli"
require "rainbow"
# TODO: Create a test and pull request for this monkey patch
# that handles an empty file without blowing up.
module GLI
module AppSupport
def parse_config # :nodoc:
config = { 'commands' => {} }
if @config_file && File.exist... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/settings.rb | Ruby | mit | 90 | master | 1,671 | module Kindle
class Settings
KINDLE_SETTINGS_DIRECTORY = "#{ENV["HOME"]}/.kindle"
KINDLE_SETTINGS_FILENAME = "#{KINDLE_SETTINGS_DIRECTORY}/kindlerc.yml"
KINDLE_DATABASE_FILENAME = "#{KINDLE_SETTINGS_DIRECTORY}/kindle.db"
attr_reader :settings
def initialize
create_default_settings_direc... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/parser/agent.rb | Ruby | mit | 90 | master | 250 | module Kindle
module Parser
class Agent
def agent
return @agent if @agent
@agent = Mechanize.new
@agent.redirect_ok = true
@agent.user_agent_alias = 'Mac Mozilla'
@agent
end
end
end
end |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/parser/annotations.rb | Ruby | mit | 90 | master | 5,583 | require "mechanize"
require "nokogiri"
require "json"
require_relative "agent"
require_relative "../remote/highlight"
require_relative "../remote/book"
require_relative "../models/highlight"
require_relative "../models/book"
module Kindle
module Parser
class Annotations
SETTINGS = Kindle::Settings.new
... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/exports/csv.rb | Ruby | mit | 90 | master | 361 | module Kindle
module Exports
class Csv
def initialize(highlights)
@document = "highlight,book title,book author,book asin\n"
highlights.each do |h|
@document << "\"#{h.highlight}\",\"#{h.book.title}\",\"#{h.book.author}\",#{h.book.asin}\n"
end
end
def to_s
... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/exports/markdown.rb | Ruby | mit | 90 | master | 420 | module Kindle
module Exports
class Markdown
def initialize(books)
@document = "## Kindle Highlights\n\n"
books.each do |book|
@document << "\n### #{book.title} by #{book.author}\n\n"
book.highlights.each do |highlight|
@document << "> #{highlight.highlight}\n\... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/exports/json.rb | Ruby | mit | 90 | master | 205 | module Kindle
module Exports
class Json
def initialize(highlights)
@document = highlights.to_json(include: :book)
end
def to_s
@document
end
end
end
end |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/remote/book.rb | Ruby | mit | 90 | master | 390 | module Kindle
module Remote
class Book
attr_accessor :asin, :title, :author, :highlight_count, :highlights
def initialize(asin, options = {})
@asin = asin
@title = options[:title]
@author = options[:author]
@highlight_count = options[:highl... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/remote/highlight.rb | Ruby | mit | 90 | master | 281 | module Kindle
module Remote
class Highlight
attr_accessor :highlight, :amazon_id, :asin
def initialize(options = {})
@highlight = options[:highlight]
@amazon_id = options[:amazon_id]
@asin = options[:asin]
end
end
end
end |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/models/highlight.rb | Ruby | mit | 90 | master | 588 | module Kindle
module Models
class Highlight < ActiveRecord::Base
attribute :amazon_id, :integer
attribute :highlight, :text
belongs_to :book
# def to_csv
# "#{id},#{asin},#{author},#{title},#{highlight},highlight_count"
# end
#
# def to_json
# {id: id, ... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/models/book.rb | Ruby | mit | 90 | master | 627 | module Kindle
module Models
class Book < ActiveRecord::Base
attribute :asin, :string
attribute :highlight_count, :integer
attribute :title, :string
attribute :author, :string
has_many :highlights
# def initialize(asin, options = {})
# @asin = asin
# ... |
github | lodestone/kindle | https://github.com/lodestone/kindle | lib/kindle/migrations/base_migration.rb | Ruby | mit | 90 | master | 422 | class CreateBaseStructure < ActiveRecord::Migration[5.0]
def self.up
create_table :books do |t|
t.string :asin, :title, :author
t.integer :highlight_count
t.timestamps
end
create_table :highlights do |t|
t.text :highlight
t.string :amazon_id
t.integer :book_id
t.... |
github | lodestone/kindle | https://github.com/lodestone/kindle | test/highlights_test.rb | Ruby | mit | 90 | master | 230 | require "kindle"
# require 'minitest/autorun'
# require "minitest/reporters"
# Minitest::Reporters.use!
# class HighlightsTest < Minitest::Test
#
# def test_we_are_generally_okay
# assert Kindle::Highlight
# end
#
# end |
github | lodestone/kindle | https://github.com/lodestone/kindle | test/kindle_test.rb | Ruby | mit | 90 | master | 425 | require_relative "../lib/kindle"
describe "Kindle" do
def login; "jo@nx.is"; end
def password; "seekrut1"; end
it "should be doing generally okay" do
expect { Kindle::HighlightsParser.new(login: login, password: password) }.not_to raise_error
end
it 'does something' do
khp = Kindle::HighlightsPars... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | Rakefile | Ruby | mit | 90 | master | 273 | $:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require "bundler/gem_tasks"
$:.unshift("./lib/")
require './lib/geomotion'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'Geomotion'
end |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | Geomotion.gemspec | Ruby | mit | 90 | master | 665 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/geomotion/version', __FILE__)
Gem::Specification.new do |s|
s.name = "geomotion"
s.version = Geomotion::VERSION
s.authors = ["Clay Allsopp", "Colin T.A. Gray"]
s.email = ["clay@usepropeller.com", "colinta@gmail.com"]
s.homepage ... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion.rb | Ruby | mit | 90 | master | 302 | require "geomotion/version"
unless defined?(Motion::Project::Config)
raise "This file must be required within a RubyMotion project Rakefile."
end
Motion::Project::App.setup do |app|
Dir.glob(File.join(File.dirname(__FILE__), 'geomotion/*.rb')).each do |file|
app.files.unshift(file)
end
end |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion/ca_transform_3d.rb | Ruby | mit | 90 | master | 6,052 | class CATransform3D
# CATransform3D.make # default transform: identity matrix
# # make a transform from scratch. please don't ever do this ;-)
# CATransform3D.make(
# m11: 1, m12: 0, m13: 0, m14: 0,
# m21: 0, m22: 1, m23: 0, m24: 0,
# m31: 0, m32: 0, m33: 1, m34: 0,
# m41: 0, m42: 0, m43: 0, m44:... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion/cg_affine_transform.rb | Ruby | mit | 90 | master | 4,688 | class CGAffineTransform
# CGAffineTransform.make # default transform: identity matrix
# # make a transform from scratch
# CGAffineTransform.make(a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0)
#
# # make a transform using primitives
# CGAffineTransform.make(scale: 2, translate: [10, 10], rotate: Math::PI)
def self... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion/cg_size.rb | Ruby | mit | 90 | master | 2,712 | class CGSize
# CGSize.make(width: 10, height: 30)
def self.make(options = {})
CGSize.new(options[:width] || 0, options[:height] || 0)
end
def self.infinite
infinity = CGRect.null[0][0]
CGSizeMake(infinity, infinity)
end
def self.empty
CGSizeZero.dup
end
def grow(dist)
CGSize.new(s... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion/cg_rect.rb | Ruby | mit | 90 | master | 17,458 | class CGRect
class << self
# CGRect.make # default rect: {origin: {x: 0, y: 0}, size: {width:0, height:0}}
# # aka CGRectZero
# CGRect.make(x: 10, y: 30) # default size: [0, 0]
# CGRect.make(x: 10, y: 30, width:100, height: 20)
#
# point = CGPoint.make(x: 10, y: 30)
# size ... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion/cg_point.rb | Ruby | mit | 90 | master | 2,698 | class CGPoint
# CGPoint.make(x: 10, y: 30)
def self.make(options = {})
CGPoint.new(options[:x] || 0, options[:y] || 0)
end
# size = CGSize.make width: 100, height: 100
# point = CPPoint.make x:0, y:10
# point.rect_of_size(size) # => CGRect([0, 10], [100, 100])
# point.rect_of_size([10, 20]) # => C... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | lib/geomotion/functions.rb | Ruby | mit | 90 | master | 1,049 | def CGRect(*args)
if args.length == 1 && args[0].is_a?(Hash)
CGRect.make(args[0])
elsif args.length == 1
CGRect.new(*args[0])
elsif args.length == 4
CGRect.new([args[0], args[1]], [args[2], args[3]])
else
CGRect.new(*args)
end
end
def CGSize(*args)
if args.length == 1 && args[0].is_a?(Hash... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | app/perspective_controller.rb | Ruby | mit | 90 | master | 2,230 | class PerspectiveController < UIViewController
def viewDidLoad
self.title = 'Perspective'
@restore = {
red: false, green: false, blue: false,
}
red = UIButton.buttonWithType(UIButtonTypeCustom)
red.setTitle('0.004, 0', forState: UIControlStateNormal)
red.backgroundColor = UIColor.redCo... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | app/next_controller.rb | Ruby | mit | 90 | master | 417 | class ShowNextController < UIViewController
def init
super.tap do
if next_controller
navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithTitle('Next', style:UIBarButtonItemStylePlain, target:self, action: :show_next)
end
end
end
def show_next
navigationController.pu... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | app/shearing_controller.rb | Ruby | mit | 90 | master | 2,210 | class ShearingController < ShowNextController
def viewDidLoad
self.title = 'Shearing'
@restore = {
red: false, green: false, blue: false,
}
red = UIButton.buttonWithType(UIButtonTypeCustom)
red.setTitle('0.5, 0', forState: UIControlStateNormal)
red.backgroundColor = UIColor.redColor
... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | app/app_delegate.rb | Ruby | mit | 90 | master | 361 | class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
ctlr = ShearingController.new
first = UINavigationController.alloc.initWithRootViewController(ctlr)
@window.rootViewController = first
@win... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | spec/cg_affine_transform_spec.rb | Ruby | mit | 90 | master | 8,720 | describe "CGAffineTransform" do
describe "operations" do
it "should support ==" do
CGAffineTransformMake(2, 0, 0, 2, 0, 0).should == CGAffineTransformMake(2, 0, 0, 2, 0, 0)
end
it "should support +" do
t1 = CGAffineTransformMake(2, 0, 0, 2, 0, 0)
t2 = CGAffineTransformMake(1, 0, 0, 1,... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | spec/cg_size_spec.rb | Ruby | mit | 90 | master | 4,452 | describe "CGSize" do
before do
@size = CGSize.make(width: 100, height: 200)
end
describe ".make" do
it "should work with options" do
CGSizeEqualToSize(@size, CGSizeMake(100, 200)).should == true
end
it "should work with no options" do
CGSizeEqualToSize(CGSize.make, CGSizeMake(0, 0)).... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | spec/function_spec.rb | Ruby | mit | 90 | master | 2,573 | describe "Functions" do
describe "CGRect" do
it "should work with one array" do
rect = CGRect([[0, 0], [0, 0]])
rect.should.be.kind_of(CGRect)
end
it "should work with two arrays" do
rect = CGRect([0, 0], [0, 0])
rect.should.be.kind_of(CGRect)
end
it "should work with four ... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | spec/cg_rect_spec.rb | Ruby | mit | 90 | master | 31,043 | describe "CGRect" do
before do
@rect = CGRect.make(x: 10, y: 100, width: 50, height: 20)
end
describe ".make" do
it "should work with options" do
CGRectEqualToRect(@rect, CGRectMake(10, 100, 50, 20)).should == true
end
it "should work with nested options (CGPoint, CGSize)" do
CGRectE... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | spec/ca_transform_3d_spec.rb | Ruby | mit | 90 | master | 12,864 | describe "CATransform3D" do
describe "operations" do
it "should support ==" do
CATransform3D.make(
m11: 1, m12: 0, m13: 0, m14: 0,
m21: 0, m22: 1, m23: 0, m24: 0,
m31: 0, m32: 0, m33: 1, m34: 0,
m41: 0, m42: 0, m43: 0, m44: 1,
).should == CATransform3D.make(
m... |
github | clayallsopp/geomotion | https://github.com/clayallsopp/geomotion | spec/cg_point_spec.rb | Ruby | mit | 90 | master | 5,953 | describe "CGPoint" do
before do
@point = CGPoint.make(x: 10, y: 20)
end
describe ".make" do
it "should work with options" do
CGPointEqualToPoint(@point, CGPointMake(10, 20)).should == true
end
it "should work with no options" do
CGPointEqualToPoint(CGPoint.make, CGPointMake(0, 0)).sh... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | twitter4r.gemspec | Ruby | mit | 90 | master | 2,054 | # Generated: Sat, 19 Sep 2009 21:39:39 -0000
Gem::Specification.new do |s|
s.name = "twitter4r"
s.version = "0.3.2"
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = ["README","CHANGES","TODO","MIT-LICENSE",]
s.summary = "A clean Twitter client API in pure Ruby. Will include Twitter ad... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | Rakefile | Ruby | mit | 90 | master | 481 | $:.unshift('lib')
require('rubygems')
gem('rspec')
ROOT_DIR = File.join(File.dirname(__FILE__))
require('rake')
require('twitter')
import('tasks/clean.rake')
import('tasks/doc.rake')
import('tasks/find.rake')
#import('tasks/metrics.rake')
import('tasks/pkg.rake')
import('tasks/rubyforge.rake')
import('tasks/spec.ra... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/db/schema.rb | Ruby | mit | 90 | master | 236 | # This file is autogenerated. Instead of editing this file, please use the
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
ActiveRecord::Schema.define() do
end |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/spec/spec_helper.rb | Ruby | mit | 90 | master | 918 | # This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec/rails'
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/spec/controllers/tweets_controller_spec.rb | Ruby | mit | 90 | master | 8,169 | require File.dirname(__FILE__) + '/../spec_helper'
describe TweetsController, "#route_for" do
it "should map { :controller => 'tweets', :action => 'index' } to /my/tweets" do
route_for(:controller => "tweets", :action => "index").should == "/my/tweets"
end
it "should map { :controller => 'tweets', :actio... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/spec/views/tweets/index.rhtml_spec.rb | Ruby | mit | 90 | master | 843 | require File.dirname(__FILE__) + '/../../spec_helper'
describe "/tweets/index.rhtml" do
include TweetsHelper
before do
tweet_98 = mock_model(Twitter::Status)
tweet_99 = mock_model(Twitter::Status)
user = mock_model(Twitter::User)
user.stub!(:screen_name).and_return("screen_name")
tweet_98.st... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/spec/views/tweets/new.rhtml_spec.rb | Ruby | mit | 90 | master | 278 | require File.dirname(__FILE__) + '/../../spec_helper'
describe "/tweets/new.rhtml" do
include TweetsHelper
it "should render new form" do
render "/tweets/new.rhtml"
response.should have_tag("form[action=?][method=post]", tweets_path) do
end
end
end |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/spec/views/tweets/show.rhtml_spec.rb | Ruby | mit | 90 | master | 576 | require File.dirname(__FILE__) + '/../../spec_helper'
describe "/tweets/show.rhtml" do
include TweetsHelper
before do
@tweet = mock_model(Twitter::Status)
@user = mock_model(Twitter::User)
@user.stub!(:screen_name).and_return("screen_name")
@tweet.stub!(:user).and_return(@user)
@tweet.stub!(... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/app/controllers/tweets_controller.rb | Ruby | mit | 90 | master | 2,237 | class TweetsController < ApplicationController
# GET /tweets
# GET /tweets.json
# GET /tweets.xml
def index
respond_to do |format|
begin
@tweets = TweetApp::ClientContext.timeline_for(:me)
format.html # index.rhtml
format.json { render :json => @tweets.to_json }
format.... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/app/controllers/application.rb | Ruby | mit | 90 | master | 337 | # Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_rails.good... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/config/routes.rb | Ruby | mit | 90 | master | 1,018 | ActionController::Routing::Routes.draw do |map|
map.resources :tweets, :path_prefix => '/my'
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assi... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/config/environment.rb | Ruby | mit | 90 | master | 2,713 | # Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION ... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/config/boot.rb | Ruby | mit | 90 | master | 1,549 | # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.post-0_2_4/config/environments/development.rb | Ruby | mit | 90 | master | 910 | # Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.pre-0_2_4/config/twitter4r.rb | Ruby | mit | 90 | master | 2,745 | require('rubygems')
gem('twitter4r', '>=0.2.0')
module Twitter; end
# For better unicode support
$KCODE = 'u'
require 'jcode'
# External requires
require('net/https')
require('uri')
require('json')
# Ordering matters...pay attention here!
#require('twitter/ext/stdlib')
require('twitter/version')
require('twitter/met... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.pre-0_2_4/config/environment.rb | Ruby | mit | 90 | master | 2,682 | # Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION ... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | marketing/samples/twitter4rails.pre-0_2_4/db/schema.rb | Ruby | mit | 90 | master | 915 | # This file is autogenerated. Instead of editing this file, please use the
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
ActiveRecord::Schema.define(:version => 2) do
create_table "tweets", :force => true do |t|
t.column "text", :... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter.rb | Ruby | mit | 90 | master | 687 | #
require('rubygems')
module Twitter; end
def require_local(suffix)
require(File.expand_path(File.join(File.dirname(__FILE__), suffix)))
end
# For better unicode support in 1.8
if RUBY_VERSION < '1.9'
$KCODE = 'u'
require 'jcode'
end
# External requires
require('yaml')
require('date')
require('time')
require(... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/meta.rb | Ruby | mit | 90 | master | 1,436 | # meta.rb contains <tt>Twitter::Meta</tt> and related classes that
# help define the metadata of the <tt>Twitter4R</tt> project.
require('rubygems')
require('erb')
class Twitter::Meta #:nodoc:
attr_accessor :root_dir
attr_reader :gem_spec, :project_files, :spec_files
# Initializer for Twitter::Meta class. Tak... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/console.rb | Ruby | mit | 90 | master | 1,018 | # Contains hooks for the twitter console
require('optparse')
module Twitter
class Client
class << self
# Helper method mostly for irb shell prototyping.
#
# Reads in login/password Twitter credentials from YAML file
# found at the location given by <tt>config_file</tt> that has
#... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/config.rb | Ruby | mit | 90 | master | 3,289 | # config.rb contains classes, methods and extends existing Twitter4R classes
# to provide easy configuration facilities.
module Twitter
# Represents global configuration for Twitter::Client.
# Can override the following configuration options:
# * <tt>protocol</tt> - <tt>:http</tt>, <tt>:https</tt> or <tt>:ssl</... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/core.rb | Ruby | mit | 90 | master | 4,818 | # The Twitter4R API provides a nicer Ruby object API to work with
# instead of coding around the REST API.
# Module to encapsule the Twitter4R API.
module Twitter
# Mixin module for classes that need to have a constructor similar to
# Rails' models, where a <tt>Hash</tt> is provided to set attributes
# appropri... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/extras.rb | Ruby | mit | 90 | master | 1,249 | # extra.rb contains features that are not considered part of the core library.
# This file is not imported by doing <tt>require('twitter')</tt>, so you will
# need to import this file separately like:
# require('twitter')
# require('twitter/extras')
require('twitter')
class Twitter::Client
@@FEATURED_URIS = {
... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/version.rb | Ruby | mit | 90 | master | 455 | # version.rb contains <tt>Twitter::Version</tt> that provides helper
# methods related to versioning of the <tt>Twitter4R</tt> project.
module Twitter::Version #:nodoc:
MAJOR = 0
MINOR = 3
REVISION = 2
class << self
# Returns X.Y.Z formatted version string
def to_version
"#{MAJOR}.#{MINOR}.#{REVI... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/model.rb | Ruby | mit | 90 | master | 13,533 | # Contains Twitter4R Model API.
module Twitter
# Mixin module for model classes. Includes generic class methods like
# unmarshal.
#
# To create a new model that includes this mixin's features simply:
# class NewModel
# include Twitter::ModelMixin
# end
#
# This mixin module automatically incl... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client.rb | Ruby | mit | 90 | master | 736 | # client.rb contains the classes, methods and extends <tt>Twitter4R</tt>
# features to define client calls to the Twitter REST API.
#
# See:
# * <tt>Twitter::Client</tt>
# Used to query or post to the Twitter REST API to simplify code.
class Twitter::Client
include Twitter::ClassUtilMixin
end
require('twitter/cli... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/ext/stdlib.rb | Ruby | mit | 90 | master | 1,800 | # Contains Ruby standard library extensions specific to <tt>Twitter4R</tt> library.
# Extension to Hash to create URL encoded string from key-values
class Hash
# Returns string formatted for HTTP URL encoded name-value pairs.
# For example,
# {:id => 'thomas_hardy'}.to_http_str
# # => "id=thomas_hardy"
# ... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/messaging.rb | Ruby | mit | 90 | master | 4,121 | class Twitter::Client
@@MESSAGING_URIS = {
:received => '/direct_messages.json',
:sent => '/direct_messages/sent.json',
:post => '/direct_messages/new.json',
:delete => '/direct_messages/destroy',
}
# Provides access to Twitter's Messaging API for received and
# sent direct messages.
#
#... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/graph.rb | Ruby | mit | 90 | master | 1,339 | class Twitter::Client
@@GRAPH_URIS = {
:friends => '/friends/ids',
:followers => '/followers/ids',
}
# Provides access to the Twitter Social Graphing API.
#
# You can retrieve the full graph of a user's friends or followers in one method call.
#
# <tt>action</tt> can be any of the following va... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/favorites.rb | Ruby | mit | 90 | master | 2,194 | class Twitter::Client
# Why Twitter.com developers can't correctly document their API, I do not know!
@@FAVORITES_URIS = {
:add => '/favourings/create',
:remove => '/favourings/destroy',
}
# Provides access to the Twitter list favorites API.
#
# You can access the authenticated [Twitter] user's fa... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/search.rb | Ruby | mit | 90 | master | 771 | class Twitter::Client
@@SEARCH_URIS = {
:basic => "/search.json",
}
# Provides access to Twitter's Search API.
#
# Example:
# # For keyword search
# iterator = @twitter.search(:q => "coworking")
# while (tweet = iterator.next)
# puts tweet.text
# end
#
# An <tt>ArgumentError</tt> ... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/user.rb | Ruby | mit | 90 | master | 3,318 | class Twitter::Client
@@USER_URIS = {
:info => '/users/show.json',
:friends => '/statuses/friends.json',
:followers => '/statuses/followers.json',
}
# Provides access to Twitter's User APIs
#
# Returns user instance for the <tt>id</tt> given. The <tt>id</tt>
# can either refer to the numeric u... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/base.rb | Ruby | mit | 90 | master | 3,203 | class Twitter::Client
alias :old_inspect :inspect
def inspect
s = old_inspect
s.gsub!(/@password=".*?"/, '@password="XXXX"')
end
protected
attr_accessor :login, :password
# Returns the response of the HTTP connection.
def http_connect(body = nil, require_auth = true, service = :rest... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/account.rb | Ruby | mit | 90 | master | 800 | class Twitter::Client
@@ACCOUNT_URIS = {
:rate_limit_status => '/account/rate_limit_status',
}
# Provides access to the Twitter rate limit status API.
#
# You can find out information about your account status. Currently the only
# supported type of account status is the <tt>:rate_limit_status</tt... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/timeline.rb | Ruby | mit | 90 | master | 3,271 | class Twitter::Client
@@TIMELINE_URIS = {
:public => '/statuses/public_timeline.json',
:friends => '/statuses/friends_timeline.json',
:friend => '/statuses/friends_timeline.json',
:user => '/statuses/user_timeline.json',
:me => '/statuses/user_timeline.json',
:replies => '/statuses/replies.jso... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/auth.rb | Ruby | mit | 90 | master | 778 | class Twitter::Client
@@AUTHENTICATION_URIS = {
:verify => '/account/verify_credentials',
}
# Provides access to the Twitter verify credentials API.
#
# You can verify Twitter user credentials with minimal overhead using this method.
#
# Example:
# client.authenticate?("osxisforlightweights", "l30p... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/profile.rb | Ruby | mit | 90 | master | 983 | class Twitter::Client
@@PROFILE_URIS = {
:info => '/account/update_profile',
:colors => '/account/update_profile_colors',
:device => '/account/update_delivery_device',
}
# Provides access to the Twitter Profile API.
#
# You can update profile information. You can update the types of profile
... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/blocks.rb | Ruby | mit | 90 | master | 1,233 | class Twitter::Client
@@BLOCK_URIS = {
:add => '/blocks/create',
:remove => '/blocks/destroy',
}
# Provides access to the Twitter Block API.
#
# You can add and remove blocks to users using this method.
#
# <tt>action</tt> can be any of the following values:
# * <tt>:add</tt> - to add a bloc... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/friendship.rb | Ruby | mit | 90 | master | 1,324 | class Twitter::Client
@@FRIENDSHIP_URIS = {
:add => '/friendships/create',
:remove => '/friendships/destroy',
}
# Provides access to the Twitter Friendship API.
#
# You can add and remove friends using this method.
#
# <tt>action</tt> can be any of the following values:
# * <tt>:add</tt> - t... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | lib/twitter/client/status.rb | Ruby | mit | 90 | master | 2,349 | class Twitter::Client
@@STATUS_URIS = {
:get => '/statuses/show.json',
:post => '/statuses/update.json',
:delete => '/statuses/destroy.json',
:reply => '/statuses/update.json'
}
# Provides access to individual statuses via Twitter's Status APIs
#
# <tt>action</tt> can be of the following value... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/spec.rake | Ruby | mit | 90 | master | 983 | gem 'rspec', '>=1.0.0'
require('spec')
require('spec/rake/spectask')
require('spec/rake/verify_rcov')
#require('rcov_report')
gem 'ZenTest'
require('autotest')
require('autotest/rspec')
meta = Twitter::Meta.new(File.join(File.dirname(__FILE__), '..'))
namespace :spec do
desc "Run specs"
Spec::Rake::SpecTask.new(... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/web.rake | Ruby | mit | 90 | master | 511 | require('rake/contrib/rubyforgepublisher')
namespace :web do
desc "Build the website, but do not publish it"
task :build => [:clobber, :coverage, 'spec:html', :webgen, :failing_examples_with_html, :examples_specdoc, :rdoc, :rdoc_rails]
desc "Upload Website to RubyForge"
task :publish => [:verify_user, :websit... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/rubyforge.rake | Ruby | mit | 90 | master | 705 | require('rake/contrib/rubyforgepublisher')
def rf_publisher
rf_user = ENV['RUBYFORGE_USER']
publisher = Rake::CompositePublisher.new
# publisher.add(Rake::RubyForgePublisher.new('twitter4r', rf_user))
publisher.add(Rake::SshDirPublisher.new("#{rf_user}@rubyforge.org",
... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/stats.rake | Ruby | mit | 90 | master | 1,287 | require('code_statistics')
class CodeStatistics
TEST_TYPES = %w(Specs) unless defined?(TEST_TYPES)
def to_embedded_html
output = "<table id=\"stats\">\n"
output << "\t<th><td>Name</td><td>Lines</td><td>LOC</td><td>Classes</td><td>Methods</td><td>M/C</td><td>LOC/M</td></th>\n"
@pairs.each { |p| output ... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/find.rake | Ruby | mit | 90 | master | 507 | def egrep(pattern)
Dir.glob('**/*.rb').each do |name|
count = 0
open(name) do |f|
while line = f.gets
count += 1
if line =~ pattern
puts "#{name}:#{count}:#{line}"
end
end
end
end
end
namespace :find do
desc "Find TODO tags in the code"
task :todos do
... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/doc.rake | Ruby | mit | 90 | master | 570 | require 'rake/rdoctask'
desc 'Generate RDoc'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Twitter4R v#{Twitter::Version.to_version}: Open Source Ruby Client Library for the Twitter REST API"
rdoc.template = 'config/rdoc_template.rb'
rdoc.options << '--line-numbers' << '--inline-source'... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/pkg.rake | Ruby | mit | 90 | master | 626 | require('rake/gempackagetask')
meta = Twitter::Meta.new(ROOT_DIR)
namespace :package do
desc "Create Gem Packages"
Rake::GemPackageTask.new(meta.gem_spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
end
namespace :gemspec do
desc "Create GemSpec"
task :generate do
spec = meta.pkg_info['... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | tasks/metrics.rake | Ruby | mit | 90 | master | 316 | require('metric_fu')
MetricFu::Configuration.run do |config|
config.metrics = [:coverage, :flog, :flay, :reek, :roodi, :churn]
# config.coverage = { :test_files => "spec/**/*_spec.rb" }
config.flog = { :dirs_to_flog => ['lib'] }
config.saikuro = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
end |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | spec/spec_helper.rb | Ruby | mit | 90 | master | 5,028 | $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'spec'
def require_project_file(file)
require(File.join(File.dirname(__FILE__), '..', 'lib', file))
end
require_project_file('twitter')
require_project_file('twitter/console')
require_project_file('twitter/extras')
# Add helper methods here if re... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | spec/twitter/core_spec.rb | Ruby | mit | 90 | master | 3,879 | require File.join(File.dirname(__FILE__), '..', 'spec_helper')
describe "Twitter::ClassUtilMixin mixed-in class" do
before(:each) do
class TestClass
include Twitter::ClassUtilMixin
attr_accessor :var1, :var2, :var3
end
@init_hash = { :var1 => 'val1', :var2 => 'val2', :var3 => 'val3' }
end
... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | spec/twitter/model_spec.rb | Ruby | mit | 90 | master | 14,606 | require File.join(File.dirname(__FILE__), '..', 'spec_helper')
module Test
class Model
include Twitter::ModelMixin
end
end
describe Twitter::Status, "unmarshaling" do
before(:each) do
@json_hash = { "text" => "Thinking Zipcar is lame...",
"id" => 46672912,
"user" =>... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | spec/twitter/version_spec.rb | Ruby | mit | 90 | master | 549 | require File.join(File.dirname(__FILE__), '..', 'spec_helper')
VERSION_LIST = [Twitter::Version::MAJOR, Twitter::Version::MINOR, Twitter::Version::REVISION]
EXPECTED_VERSION = VERSION_LIST.join('.')
EXPECTED_NAME = VERSION_LIST.join('_')
describe Twitter::Version, ".to_version" do
it "should return #{EXPECTED_VERS... |
github | mbbx6spp/twitter4r | https://github.com/mbbx6spp/twitter4r | spec/twitter/config_spec.rb | Ruby | mit | 90 | master | 2,364 | require File.join(File.dirname(__FILE__), '..', 'spec_helper')
describe Twitter::Client, ".configure" do
it "should respond to :configure class method" do
Twitter::Client.respond_to?(:configure).should be(true)
end
it "should not accept calls that do not specify blocks" do
lambda {
Twitter::Clie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.