repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/02_fanout.rb | examples/02_fanout.rb | # Subscribe to a timeline, publish an event, verify fanout to other timelines
require 'boilerplate'
connection = Chronologic::Client::Connection.new('http://localhost:7979')
connection.subscribe("tech", "home")
event = Chronologic::Event.new
event.key = "story_1"
event.timestamp = Time.now.utc
event.data = {
"head... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/twitter.rb | examples/twitter.rb | #!/usr/bin/env ruby
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'chronologic'
c = Chronologic::Connection.new
c.clear!
puts "creating user objects"
c.object(:user_1, {:name => 'sco'})
c.object(:user_2, {:name => 'jw'})
c.object(:user_3, {:name => 'keeg'})
puts "jw follows sco and keeg"
c... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/03_subevents.rb | examples/03_subevents.rb | # Publish an event, publish a subevent, fetch both in one operation
require 'boilerplate'
connection = Chronologic::Client::Connection.new('http://localhost:7979')
event = Chronologic::Event.new
event.key = "story_1"
event.timestamp = Time.now
event.data = {
"headline" => "First ever post in Chronologic!",
"lede"... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/04_objects.rb | examples/04_objects.rb | # Create some objects, publish an event, publish a subevent, fetch it all
require 'boilerplate'
connection = Chronologic::Client::Connection.new('http://localhost:7979')
connection.record("author_1", {"name" => "Adam"})
connection.record("author_2", {"name" => "Fred Derp"})
event = Chronologic::Event.new
event.key =... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/gowalla_activerecord.rb | examples/gowalla_activerecord.rb | #!/usr/bin/env ruby
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'chronologic'
require 'rubygems'
require 'active_record'
puts "Creating database and models..."
orig_stdout = $stdout
$stdout = File.new('/dev/null', 'w') # shush, activerecord!
ActiveRecord::Base.establish_connection(:adapte... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/01_hello_cl.rb | examples/01_hello_cl.rb | require 'boilerplate'
connection = Chronologic::Client::Connection.new('http://localhost:7979')
event = Chronologic::Event.new
event.key = "story_1"
event.timestamp = Time.now.utc
event.data = {
"headline" => "First ever post in Chronologic!",
"lede" => "A monumental occasion for housecats everywhere.",
"body" ... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/outings.rb | examples/outings.rb | require "chronologic"
cl = Chronologic::Client.new("http://localhost:7979")
# Create ten events, push to ten timelines, unpublish them, and publish a new
# event in the middle of the sequence
user = "outing_user_0"
users = 10.times.map { |i| "outing_user_#{i + 1}" }
# users.each { |u| cl.subscribe("outing_user_#{u}_... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/examples/groupings.rb | examples/groupings.rb | require 'pp'
require 'chronologic'
cl = Chronologic::Client.new('http://localhost:7979')
user = 'grouping_user_0'
events = 2.times.map do |i|
event = Chronologic::Event.new.tap do |e|
e.key = "grouping_checkin_#{i}"
e.timestamp = Time.now + i
e.data = {'message' => "This is checkin #{i}"}
e.timelin... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic.rb | lib/chronologic.rb | require "hashie"
require "active_support/core_ext/module"
require "chronologic/cassandra_ext"
require "multi_json"
module Chronologic
mattr_accessor :connection
def self.schema
Chronologic::Service::Schema
end
module Event
autoload :State, "chronologic/event"
autoload :Behavior, "chronologic/eve... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/version.rb | lib/chronologic/version.rb | module Chronologic
VERSION = '0.10.2'
end | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/event.rb | lib/chronologic/event.rb | require 'active_support/core_ext/hash'
require 'active_support/concern'
require "time"
module Chronologic::Event::State
extend ActiveSupport::Concern
included do
attr_accessor :key, :data, :objects, :timelines, :subevents
end
def initialize
@key = ''
@token = ''
@data = {}
... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/cassandra_ext.rb | lib/chronologic/cassandra_ext.rb | # Extensions/bugfixes to fauna/cassandra
class Cassandra
# Fix interface incompatibility due to new Thrift interface in Cassandra
# 0.7.x
def _count_columns(column_family, key, super_column, consistency)
parent = CassandraThrift::ColumnParent.new(
:column_family => column_family,
:super_column =>... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/feed.rb | lib/chronologic/service/feed.rb | require 'chronologic/service/feed_boilerplate'
class Chronologic::Service::Feed
include Chronologic::Service::FeedBoilerplate
def items
return @items if @items
set_next_page
set_count
events = schema.fetch_timelines(timeline_key, per_page, start)
subevents = schema.fetch_timelines(events.map... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/event.rb | lib/chronologic/service/event.rb | class Chronologic::Service::Event
include Chronologic::Event::Behavior
include Chronologic::Event::State
attr_accessor :token
def self.from_attributes(hsh)
obj = super.tap do |e|
e.token = hsh.with_indifferent_access.fetch(:token, '')
end
end
def self.from_columns(columns)
from_attribut... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/objectless_feed.rb | lib/chronologic/service/objectless_feed.rb | require 'chronologic/service/feed_boilerplate'
class Chronologic::Service::ObjectlessFeed
include Chronologic::Service::FeedBoilerplate
def items
return @items if @items
set_next_page
set_count
events = schema.fetch_timelines(timeline_key, per_page, start)
subevents = schema.fetch_timelines(... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/feed_boilerplate.rb | lib/chronologic/service/feed_boilerplate.rb | require 'active_support/concern'
module Chronologic::Service::FeedBoilerplate
extend ActiveSupport::Concern
included do
attr_accessor :timeline_key, :per_page, :start, :subevents
attr_accessor :next_page, :count
end
module ClassMethods
def create(timeline_key, options={})
fetch_subevents =... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/app.rb | lib/chronologic/service/app.rb | require "sinatra/base"
require "active_support/core_ext/class"
# TODO: caching headers?
class Chronologic::Service::App < Sinatra::Base
cattr_accessor :logger
post "/object" do
log_params
protocol.record(params["object_key"], params["data"])
status 201
end
get "/object/:object_key" do
log_p... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/protocol.rb | lib/chronologic/service/protocol.rb | require "time"
require "hashie/mash"
module Chronologic::Service::Protocol
SUBSCRIBE_BACKFILL_COUNT = 20
def self.record(object_key, data)
schema.create_object(object_key, data)
end
def self.unrecord(object_key)
schema.remove_object(object_key)
end
def self.retrieve(object_key)
schema.object... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/service/schema.rb | lib/chronologic/service/schema.rb | module Chronologic::Service::Schema
mattr_accessor :write_opts
mattr_accessor :consistent_read_opts
mattr_accessor :logger
self.write_opts = {:consistency => Cassandra::Consistency::QUORUM}
self.consistent_read_opts = {:consistency => Cassandra::Consistency::QUORUM}
MAX_SUBSCRIPTIONS = 50_000
MAX_TIMEL... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/client/event.rb | lib/chronologic/client/event.rb | class Chronologic::Client::Event
include Chronologic::Event::Behavior
include Chronologic::Event::State
def initialize
@published = false
end
def to_transport
{
"key" => key,
"data" => json_encode(data),
"objects" => json_encode(objects),
"timelines" => json_encode(timelines)... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/client/connection.rb | lib/chronologic/client/connection.rb | require "active_support/core_ext/module"
require 'active_support/core_ext/hash'
require "httparty"
class Chronologic::Client::Connection
include HTTParty
mattr_accessor :instance
def initialize(host)
self.class.default_options[:base_uri] = host
end
def record(object_key, data)
body = {"object_key... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
gowalla-archive/chronologic | https://github.com/gowalla-archive/chronologic/blob/1fecdea9edce001e10e024fae43bf4c06f837b98/lib/chronologic/client/fake.rb | lib/chronologic/client/fake.rb | require 'active_support/core_ext/hash'
class Chronologic::Client::Fake
attr_reader :objects, :subscribers, :events, :timelines
def initialize
@objects = {}
@subscribers = Hash.new { |hsh, k| hsh[k] = {} }
@events = {}
@timelines = Hash.new { |hsh, k| hsh[k] = {} }
end
def record(object_key, ... | ruby | MIT | 1fecdea9edce001e10e024fae43bf4c06f837b98 | 2026-01-04T17:43:46.847213Z | false |
Leadformance/hstore_translate | https://github.com/Leadformance/hstore_translate/blob/f0cd924cb5e967331be6e3572de14a3f6077b948/test/translates_test.rb | test/translates_test.rb | # -*- encoding : utf-8 -*-
require 'test_helper'
class TranslatesTest < HstoreTranslate::Test
def test_assigns_in_current_locale
I18n.with_locale(:en) do
p = Post.new(:title => "English Title")
assert_equal("English Title", p.title_translations['en'])
end
end
def test_retrieves_in_current_lo... | ruby | MIT | f0cd924cb5e967331be6e3572de14a3f6077b948 | 2026-01-04T17:43:58.565293Z | false |
Leadformance/hstore_translate | https://github.com/Leadformance/hstore_translate/blob/f0cd924cb5e967331be6e3572de14a3f6077b948/test/test_helper.rb | test/test_helper.rb | require 'minitest/autorun'
require 'hstore_translate'
require 'database_cleaner'
DatabaseCleaner.strategy = :transaction
MiniTest::Test = MiniTest::Unit::TestCase unless MiniTest.const_defined?(:Test) # Rails 4.0.x
class Post < ActiveRecord::Base
translates :title
end
class HstoreTranslate::Test < Minitest::Test
... | ruby | MIT | f0cd924cb5e967331be6e3572de14a3f6077b948 | 2026-01-04T17:43:58.565293Z | false |
Leadformance/hstore_translate | https://github.com/Leadformance/hstore_translate/blob/f0cd924cb5e967331be6e3572de14a3f6077b948/lib/hstore_translate.rb | lib/hstore_translate.rb | require 'active_record'
require 'active_record/connection_adapters/postgresql_adapter'
require 'hstore_translate/translates'
module HstoreTranslate
def self.native_hstore?
@native_hstore ||= ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES.key?(:hstore)
end
end
require 'activerecord-... | ruby | MIT | f0cd924cb5e967331be6e3572de14a3f6077b948 | 2026-01-04T17:43:58.565293Z | false |
Leadformance/hstore_translate | https://github.com/Leadformance/hstore_translate/blob/f0cd924cb5e967331be6e3572de14a3f6077b948/lib/hstore_translate/translates.rb | lib/hstore_translate/translates.rb | module HstoreTranslate
module Translates
SUFFIX = "_translations"
def translates(*attrs)
include InstanceMethods
class_attribute :translated_attrs
alias_attribute :translated_attribute_names, :translated_attrs # Improve compatibility with the gem globalize
self.translated_attrs = att... | ruby | MIT | f0cd924cb5e967331be6e3572de14a3f6077b948 | 2026-01-04T17:43:58.565293Z | false |
Leadformance/hstore_translate | https://github.com/Leadformance/hstore_translate/blob/f0cd924cb5e967331be6e3572de14a3f6077b948/lib/hstore_translate/version.rb | lib/hstore_translate/version.rb | module HstoreTranslate
VERSION = "1.0.1"
end
| ruby | MIT | f0cd924cb5e967331be6e3572de14a3f6077b948 | 2026-01-04T17:43:58.565293Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/fact_models.rb | test/fact_models.rb | class FigureFactModel < ActiveReporting::FactModel
dimension :kind
dimension :series
dimension_filter :kind_is, ->(k) { where(kind: k) }
end
class ReleaseDateFactModel < ActiveReporting::FactModel
dimension :amiibo
dimension :location
dimension :released_on
end
class GameCompatabilityFactModel < ActiveRe... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting_test.rb | test/active_reporting_test.rb | require 'test_helper'
class ActiveReportingTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::ActiveReporting::VERSION
end
def test_metrics_can_be_fetched
assert ActiveReporting.fetch_metric(:a_metric).is_a? ActiveReporting::Metric
assert ActiveReporting.fetch_metric('a_metric'... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/seed.rb | test/seed.rb | (Date.new(2014,1,1)..Date.new(2017,12,31)).each do |d|
DateDimension.new_from_date(d).save!
end
(1..5).each do |i|
user = User.create!(
created_at: Time.now - i.months,
username: "user_#{i}"
)
Profile.create!(
created_at: Time.now - i.months,
user: user,
favorite_pokemon: 'Pikachu'
)
end... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | true |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/models.rb | test/models.rb | class Platform < ActiveRecord::Base
has_many :games
has_many :game_compatabilities
end
class Location < ActiveRecord::Base
has_many :release_dates
end
class Series < ActiveRecord::Base
self.table_name = 'series'
has_many :figures
end
class Game < ActiveRecord::Base
belongs_to :platform
has_many :game_... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/test_helper.rb | test/test_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
begin
require 'simplecov'
SimpleCov.start
rescue LoadError
end
require 'active_reporting'
require 'minitest/autorun'
require 'minitest/pride'
db = ENV['DB'] || 'sqlite'
case db
when 'pg'
db_config = { adapter: 'postgresql', database: 'active_reporting... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/schema.rb | test/schema.rb | ActiveRecord::Schema.define do
self.verbose = false
create_table :platforms, force: true do |t|
t.string :name, null: false
t.string :kind, null: false
end
add_index :platforms, [:name, :kind], unique: true
create_table :locations, force: true do |t|
t.string :name, null: false
end
add_index... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/metric_test.rb | test/active_reporting/metric_test.rb | require 'test_helper'
class ActiveReporting::MetricTest < Minitest::Test
def setup
@metric = ActiveReporting::Metric.new(:a_metric, fact_model: FigureFactModel, dimensions: [:kind])
end
def test_metric_makes_fact_model_avalable
assert_equal FigureFactModel, @metric.fact_model
end
def test_metric_ma... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/report_test.rb | test/active_reporting/report_test.rb | require 'test_helper'
class ActiveReporting::ReportTest < Minitest::Test
def setup
@metric = ActiveReporting::Metric.new(:a_metric, fact_model: FigureFactModel, dimensions: [:kind])
@report = ActiveReporting::Report.new(@metric)
end
def test_run_returns_an_array
assert @report.run.is_a?(Array), 'res... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/fact_model_test.rb | test/active_reporting/fact_model_test.rb | require 'test_helper'
class ActiveReporting::FactModelTest < Minitest::Test
def test_fact_model_may_be_set_by_class_name
fact_model = FigureFactModel
fact_model.instance_variable_set('@model', nil)
assert_equal Figure, fact_model.model
end
def test_fact_model_may_be_an_active_record_class
Figure... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/dimension_test.rb | test/active_reporting/dimension_test.rb | require 'test_helper'
class ActiveReporting::DimensionTest < ActiveSupport::TestCase
def test_dimension_can_have_a_type
subject = ActiveReporting::Dimension.new(FigureFactModel, name: :series)
assert_equal :standard, subject.type
subject = ActiveReporting::Dimension.new(FigureFactModel, name: :kind)
... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/reporting_dimension_test.rb | test/active_reporting/reporting_dimension_test.rb | require 'test_helper'
class ActiveReporting::ReportingDimensionTest < ActiveSupport::TestCase
def setup
@default_label = ActiveReporting::Configuration.default_dimension_label
@figure_kind_dimension = ActiveReporting::Dimension.new(FigureFactModel, name:... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/active_record_adaptor_test.rb | test/active_reporting/active_record_adaptor_test.rb | require 'test_helper'
class ActiveReporting::ActiveRecordAdaptorTest < ActiveSupport::TestCase
def test_fact_model_returns_fact_model_class
assert_equal SeriesFactModel, Series.fact_model
end
def test_fact_model_is_created_if_not_defined
Object.send(:remove_const, :ProfileFactModel) if defined?(ProfileF... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/test/active_reporting/configuration_test.rb | test/active_reporting/configuration_test.rb | require 'test_helper'
class ActiveReporting::ConfigurationTest < Minitest::Test
def setup
@default_dimension_label = ActiveReporting::Configuration.default_dimension_label
@new_value = :new_value
end
def teardown
ActiveReporting::Configuration.default_dimension_label = @default_dimension_label
end... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting.rb | lib/active_reporting.rb | # frozen_string_literal: true
require 'active_record'
require 'active_reporting/active_record_adaptor'
require 'active_reporting/configuration'
require 'active_reporting/dimension'
require 'active_reporting/dimension_filter'
require 'active_reporting/metric'
require 'active_reporting/fact_model'
require 'active_report... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/report.rb | lib/active_reporting/report.rb | # frozen_string_literal: true
require 'forwardable'
module ActiveReporting
class Report
AGGREGATE_FUNCTION_OPERATORS = {
eq: '=',
gt: '>',
gte: '>=',
lt: '<',
lte: '<='
}.freeze
extend Forwardable
def_delegators :@metric, :fact_model, :model
def initialize(... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/dimension_filter.rb | lib/active_reporting/dimension_filter.rb | # frozen_string_literal: true
module ActiveReporting
class DimensionFilter
attr_reader :name, :type, :body
# Factory for creating a new DimensionFilter
#
# Determines the type based on if passed in a callable object or a symbol
#
# @param name (Symbol)
# @param lambda_or_type (Symbol, La... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/version.rb | lib/active_reporting/version.rb | # frozen_string_literal: true
module ActiveReporting
VERSION = '0.6.2'
end
| ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/dimension.rb | lib/active_reporting/dimension.rb | # frozen_string_literal: true
module ActiveReporting
class Dimension
TYPES = { degenerate: :degenerate, standard: :standard }.freeze
attr_reader :name
# @param model [ActiveRecord::Base]
# @param name [Symbol]
def initialize(fact_model, name:)
@fact_model = fact_model
@name = n... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/reporting_dimension.rb | lib/active_reporting/reporting_dimension.rb | # frozen_string_literal: true
require 'forwardable'
module ActiveReporting
class ReportingDimension
extend Forwardable
SUPPORTED_DBS = %w[PostgreSQL PostGIS Mysql2].freeze
# Values for the Postgres `date_trunc` method.
# See https://www.postgresql.org/docs/10/static/functions-datetime.html#FUNCTIONS-... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/active_record_adaptor.rb | lib/active_reporting/active_record_adaptor.rb | # frozen_string_literal: true
module ActiveReporting
# This is included into every class that inherits from ActiveRecord::Base
module ActiveRecordAdaptor
# Returns the ActiveReporting::FactModel related to the model.
#
# If one is not explictily defined, a constant will be created which
# inherits ... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/configuration.rb | lib/active_reporting/configuration.rb | # frozen_string_literal: true
module ActiveReporting
module Configuration
class << self
# Determines if ransack is available for use in the gem
#
# @return [Boolean]
attr_accessor :ransack_available
end
def self.config
yield self
end
# The default label used by all... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/metric.rb | lib/active_reporting/metric.rb | # frozen_string_literal: true
require 'forwardable'
module ActiveReporting
AGGREGATES = %i[count sum max min avg].freeze
class Metric
extend Forwardable
def_delegators :@fact_model, :model
attr_reader :fact_model, :name, :dimensions, :dimension_filter, :aggregate
attr_reader :metric_filter, :order... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
t27duck/active_reporting | https://github.com/t27duck/active_reporting/blob/e3acf3c04fb49401aca0591ba70685ecb389d48c/lib/active_reporting/fact_model.rb | lib/active_reporting/fact_model.rb | # frozen_string_literal: true
module ActiveReporting
class FactModel
class << self
attr_reader :dimensions, :dimension_filters
attr_writer :measure
end
# Explicitly sets which ActiveRecord model to to link to this fact model.
#
# @note You should only need to set this if the name of ... | ruby | MIT | e3acf3c04fb49401aca0591ba70685ecb389d48c | 2026-01-04T17:43:59.996700Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/test/test_helper.rb | test/test_helper.rb | require 'hogan_assets'
require 'test/unit'
module HoganAssets::Config
def reset!
%w(env lambda_support path_prefix template_extensions template_namespace haml_options slim_options slimstache_extensions hamstache_extensions).each do |option|
send "#{option}=", nil
end
end
end
module TestSupport
... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/test/hogan_assets/tilt_test.rb | test/hogan_assets/tilt_test.rb | require 'test_helper'
module HoganAssets
class TiltTest < Test::Unit::TestCase
include TestSupport
def teardown
HoganAssets::Config.reset!
end
def test_mime_type
assert_equal 'application/javascript', HoganAssets::Tilt.default_mime_type
end
def test_render
scope = make_sc... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/test/hogan_assets/config_test.rb | test/hogan_assets/config_test.rb | require 'test_helper'
module HoganAssets
module Config
extend self
def yml_path=(yml_path)
@yml_path = yml_path
end
end
class ConfigTest < Test::Unit::TestCase
include TestSupport
def setup
HoganAssets::Config.env = 'test'
HoganAssets::Config.yml_path = Pathname.new('.') ... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/lib/hogan_assets.rb | lib/hogan_assets.rb | require 'hogan_assets/version'
require 'hogan_assets/config'
module HoganAssets
extend Config
autoload :Hogan, 'hogan_assets/hogan'
autoload :Tilt, 'hogan_assets/tilt'
if defined? Rails
require 'hogan_assets/engine'
else
require 'sprockets'
Config.load_yml! if Config.yml_exists?
Config.temp... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/lib/hogan_assets/tilt.rb | lib/hogan_assets/tilt.rb | require 'tilt'
module HoganAssets
class Tilt < Tilt::Template
self.default_mime_type = 'application/javascript'
def initialize_engine
load_haml
load_slim
end
def evaluate(scope, locals, &block)
template_path = TemplatePath.new scope
template_namespace = HoganAssets::Config.t... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/lib/hogan_assets/version.rb | lib/hogan_assets/version.rb | module HoganAssets
VERSION = "1.6.0"
end
| ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/lib/hogan_assets/config.rb | lib/hogan_assets/config.rb | require 'yaml'
module HoganAssets
# Change config options in an initializer:
#
# HoganAssets::Config.template_extensions = ['mustache']
#
# Or in a block:
#
# HoganAssets::Config.configure do |config|
# config.lambda_support = false
# config.path_prefix = 'templates'
# config.template_extensi... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/lib/hogan_assets/engine.rb | lib/hogan_assets/engine.rb | module HoganAssets
class Engine < ::Rails::Engine
initializer "sprockets.hogan", :after => "sprockets.environment", :group => :all do |app|
next unless app.assets
HoganAssets::Config.load_yml! if HoganAssets::Config.yml_exists?
HoganAssets::Config.template_extensions.each do |ext|
app.as... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
leshill/hogan_assets | https://github.com/leshill/hogan_assets/blob/a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277/lib/hogan_assets/hogan.rb | lib/hogan_assets/hogan.rb | # Based on https://github.com/josh/ruby-coffee-script
require 'execjs'
require 'pathname'
module HoganAssets
class Hogan
class << self
def compile(source, options = {})
context.eval("Hogan.compile(#{source.inspect}, {asString: true})")
end
private
def context
@context ||... | ruby | MIT | a57dbfb77e7cc676aaaa400c16fc4b8d9fd82277 | 2026-01-04T17:44:01.657956Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/hex_spec.rb | spec/hex_spec.rb | # encoding: US-ASCII
describe 'hex' do
it 'encodes binary to hex' do
"i\266H\034\213\253\242\266\016\217\"\027\233X\315V".to_hex.
should == '69b6481c8baba2b60e8f22179b58cd56'
"\354\336\030\333\347o\275\f33\017\0345Hq\333".to_hex.
should == 'ecde18dbe76fbd0c33330f1c354871db'
end
it 'decodes ... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/yubikey_spec.rb | spec/yubikey_spec.rb | describe Yubikey do
after do
Yubikey.reset
end
describe ".api_id" do
it "should return the default api_id" do
Yubikey.api_id.should == Yubikey::Configuration::DEFAULT_API_ID
end
end
describe ".api_id=" do
it "should set the api_id" do
Yubikey.api_id = 8094
Yubikey.api_id.sh... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'rspec'
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
require 'yubikey' | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/yubikey/cert_chain_spec.rb | spec/yubikey/cert_chain_spec.rb | require File.dirname(__FILE__) + '/../spec_helper.rb'
describe "Cert Chain" do
before do
@cert_store = OpenSSL::X509::Store.new
@cert_store.add_file Yubikey.certificate_chain
end
it "should accept cert from api.yubico.com" do
uri = URI.parse('https://api.yubico.com/')
http = Net::HTTP.new(uri... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/yubikey/otp_spec.rb | spec/yubikey/otp_spec.rb | describe 'Yubikey::OTP' do
describe "should parse an OTP" do
before :all do
@token = Yubikey::OTP.new('enrlucvketdlfeknvrdggingjvrggeffenhevendbvgd', '4013a2c719c4e9734bbc63048b00e16b')
end
it "has the expected public_id" do
@token.public_id.should == 'enrlucvketdl'
end
it "has the... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/yubikey/otp_verify_spec.rb | spec/yubikey/otp_verify_spec.rb | require File.dirname(__FILE__) + '/../spec_helper.rb'
describe 'Yubikey::OTP::Verify' do
before do
@otp = 'ccccccbfueddkcnctfkrhdfrbtfutgtididiguttlctr'
@id = 8094
@key = 'NISwCZBQ0gTbuXbRGWAf4km5xXg='
@nonce = 'cEnCRWOnpFurshnksfcAEZvWoqdXlwbs'
@response = "t=2012-08-01T16:09:08Z0899\n" +
... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/spec/yubikey/modhex_spec.rb | spec/yubikey/modhex_spec.rb | # encoding: US-ASCII
describe 'Yubikey::Modhex' do
it 'decodes modhex' do
Yubikey::ModHex.decode('hknhfjbrjnlnldnhcujvddbikngjrtgh').should == "i\266H\034\213\253\242\266\016\217\"\027\233X\315V"
Yubikey::ModHex.decode('urtubjtnuihvntcreeeecvbregfjibtn').should == "\354\336\030\333\347o\275\f33\017\0345Hq\3... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/examples/otp.rb | examples/otp.rb | require 'yubikey'
key = 'ecde18dbe76fbd0c33330f1c354871db'
otp = 'dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh'
token = Yubikey::OTP.new(otp, key)
p "Device public id: #{token.public_id}"
p "Device secret id: #{token.secret_id}"
p "Device insertions: #{token.insert_counter}"
p "Session activation counter: #{token.session... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/examples/config.rb | examples/config.rb | require 'yubikey'
begin
Yubikey.configure do |config|
config.api_id = 'YOUR_API_ID'
config.api_key = 'YOUR_API_KEY'
end
otp = 'THE_OTP_TO_TEST'
token = Yubikey::OTP::Verify::new(:otp => otp)
if token.valid?
p 'valid OTP'
elsif token.replayed?
p 'replayed OTP'
else
p token.status
... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/examples/otp_verify.rb | examples/otp_verify.rb | require 'yubikey'
begin
api_id = 'YOUR_API_ID'
api_key = 'YOUR_API_KEY'
otp = 'THE_OTP_TO_TEST'
token = Yubikey::OTP::Verify::new(:api_id => api_id, :api_key => api_key, :otp => otp)
if token.valid?
p 'valid OTP'
elsif token.replayed?
p 'replayed OTP'
else
p token.status
end
rescue Yubi... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/lib/yubikey.rb | lib/yubikey.rb | $LOAD_PATH.unshift(File.dirname(__FILE__)) unless
$LOAD_PATH.include?(File.dirname(__FILE__)) || $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
require 'net/https'
require 'openssl'
require 'yubikey/configuration'
require 'yubikey/hex'
require 'yubikey/modhex'
require 'yubikey/otp'
require 'yubikey/o... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/lib/yubikey/otp.rb | lib/yubikey/otp.rb | class Yubikey::OTP
# first few modhex encoded characters of the OTP
attr_reader :public_id
# decrypted binary token
attr_reader :token
# binary AES key
attr_reader :aes_key
# hex id (encrypted in OTP)
attr_reader :secret_id
# integer that increments each time the Yubikey is plugged in
attr_reader :i... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/lib/yubikey/modhex.rb | lib/yubikey/modhex.rb | module Yubikey::ModHex
TRANS = 'cbdefghijklnrtuv'.split(//)
# Decode a ModHex string into binary data
def self.decode(modhex_string)
raise ArgumentError, "ModHex string length is not even" unless modhex_string.length % 2 == 0
chars = 'cbdefghijklnrtuv'
result = ""
modhex_string.scan(/..... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/lib/yubikey/configuration.rb | lib/yubikey/configuration.rb | module Yubikey
# Defines constants and methods related to configuration
module Configuration
# An array of valid keys in the options hash when configuring a Yubikey::OTP::Verify
VALID_OPTIONS_KEYS = [
:api_id,
:url,
:api_key,
:certificate_chain,
].freeze
# By default, we wan... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/lib/yubikey/otp_verify.rb | lib/yubikey/otp_verify.rb | require 'base64'
require 'securerandom'
require "net/http"
require "uri"
module Yubikey
class OTP::Verify
# The raw status from the Yubico server
attr_reader :status
def initialize(args)
@api_key = args[:api_key] || Yubikey.api_key
@api_id = args[:api_id] || Yubikey.api_id
... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
titanous/yubikey | https://github.com/titanous/yubikey/blob/8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78/lib/yubikey/hex.rb | lib/yubikey/hex.rb | class String
# Convert hex string to binary
def to_bin
[self].pack('H*')
end
# Convert binary string to hex
def to_hex
unpack('H*')[0]
end
# Check if the string is hex encoded
def hex?
self =~ /^[0-9a-fA-F]+$/ ? true : false
end
# Check if the string is modhex encoded
def m... | ruby | MIT | 8d1d111bfd72a96b75d266aa68bb8b6fbb8d9d78 | 2026-01-04T17:44:04.730522Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
MODELS = File.join(File.dirname(__FILE__), "models")
SUPPORT = File.join(File.dirname(__FILE__), "support")
$LOAD_PATH.unshift(MODELS)
$LOAD_PATH.unshift(SUPPORT)
require "rspec"
require "mongoid"
require "mo... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/support/authentication.rb | spec/support/authentication.rb | # encoding: utf-8
module Support #:nodoc:
module Authentication
extend self
def configured?
begin
master_uri = "mongodb://mongoid:test@localhost:27017/mongoid_spacial_test"
Mongo::Connection.from_uri(master_uri)
true
rescue Mongo::AuthenticationError => e
false
... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/tag.rb | spec/models/tag.rb | class Tag
include Mongoid::Document
field :text, :type => String
references_and_referenced_in_many :posts
references_and_referenced_in_many :related, :class_name => "Tag"
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/agent.rb | spec/models/agent.rb | class Agent
include Mongoid::Document
include Mongoid::Timestamps::Updated
field :title
field :number
embeds_many :names, :as => :namable
referenced_in :game
references_and_referenced_in_many :accounts
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/entry.rb | spec/models/entry.rb | class Entry
include Mongoid::Document
field :title, :type => String
field :body, :type => String
recursively_embeds_many
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/observed.rb | spec/models/observed.rb | class Actor
include Mongoid::Document
field :name
end
class Actress < Actor
end
class ActorObserver < Mongoid::Observer
attr_reader :last_after_create_record
def after_create(record)
@last_after_create_record = record
end
end
class CallbackRecorder < Mongoid::Observer
observe :actor
attr_reader :... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/mixed_drink.rb | spec/models/mixed_drink.rb | class MixedDrink
include Mongoid::Document
field :name
end | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/answer.rb | spec/models/answer.rb | class Answer
include Mongoid::Document
embedded_in :question
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/preference.rb | spec/models/preference.rb | class Preference
include Mongoid::Document
field :name, :type => String
field :value, :type => String
field :ranking, :type => Integer
has_and_belongs_to_many :people
validates_length_of :name, :minimum => 2, :allow_nil => true
scope :posting, where(:value.in => [ "Posting" ])
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/book.rb | spec/models/book.rb | class Book
include Mongoid::Document
field :title, :type => String
references_one :rating, :as => :ratable, :dependent => :nullify
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/paranoid_post.rb | spec/models/paranoid_post.rb | class ParanoidPost
include Mongoid::Document
include Mongoid::Versioning
include Mongoid::Timestamps
include Mongoid::Paranoia
field :title
referenced_in :person
references_and_referenced_in_many :tags
named_scope :recent, where(:created_at => { "$lt" => Time.now, "$gt" => 30.days.ago })
class << s... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/event.rb | spec/models/event.rb | class Event
include Mongoid::Document
field :title
field :date, :type => Date
references_and_referenced_in_many \
:administrators,
:class_name => 'Person',
:inverse_of => :administrated_events,
:dependent => :nullify
referenced_in :owner
def self.each_day(start_date, end_date)
groups =... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/shelf.rb | spec/models/shelf.rb | class Shelf
include Mongoid::Document
field :level, :type => Integer
recursively_embeds_one
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/country_code.rb | spec/models/country_code.rb | class CountryCode
include Mongoid::Document
field :code, :type => Integer
key :code
embedded_in :phone_number, :class_name => "Phone"
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/page_question.rb | spec/models/page_question.rb | class PageQuestion
include Mongoid::Document
embedded_in :page
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/slave_address_numbers.rb | spec/models/slave_address_numbers.rb | # These models used for Github 263
class Slave
include Mongoid::Document
field :first_name
field :last_name
embeds_many :address_numbers
end
class AddressNumber
include Mongoid::Document
field :country_code, :type => Integer, :default => 1
field :number
embedded_in :slave
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/membership.rb | spec/models/membership.rb | class Membership
include Mongoid::Document
embedded_in :account
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/employer.rb | spec/models/employer.rb | class Employer
def id
"1"
end
end | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/tree.rb | spec/models/tree.rb | class Tree
include Mongoid::Document
field :name
field :evergreen, :type => Boolean
scope :verdant, where(:evergreen => true)
default_scope asc(:name)
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/quiz.rb | spec/models/quiz.rb | class Quiz
include Mongoid::Document
include Mongoid::Timestamps::Created
field :topic
embeds_many :pages
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/inheritance.rb | spec/models/inheritance.rb | class Canvas
include Mongoid::Document
field :name
embeds_many :shapes
embeds_one :writer
embeds_one :palette
def render
shapes.each { |shape| render }
end
end
class Browser < Canvas
field :version, :type => Integer
def render; end
end
class Firefox < Browser
field :user_agent
def render; e... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/address_component.rb | spec/models/address_component.rb | class AddressComponent
include Mongoid::Document
field :street, :type => String
embedded_in :person
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/account.rb | spec/models/account.rb | class Account
include Mongoid::Document
field :number, :type => String
field :balance, :type => String
field :nickname, :type => String
field :name, :type => String
key :name
embeds_many :memberships
referenced_in :creator, :class_name => "User", :foreign_key => :creator_id
referenced_in :person
re... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/game.rb | spec/models/game.rb | class Game
include Mongoid::Document
field :high_score, :type => Integer, :default => 500
field :score, :type => Integer, :default => 0
field :name
referenced_in :person, :index => true
references_one :video, :validate => false
accepts_nested_attributes_for :person
cache
validates_format_of :name, :w... | ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
ryanong/mongoid_spacial | https://github.com/ryanong/mongoid_spacial/blob/edb363054c4449892f4a0784ad9b826156af79a0/spec/models/translation.rb | spec/models/translation.rb | class Translation
include Mongoid::Document
field :language
embedded_in :name
end
| ruby | MIT | edb363054c4449892f4a0784ad9b826156af79a0 | 2026-01-04T17:44:07.066009Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.