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 |
|---|---|---|---|---|---|---|---|---|
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/rails23_ruby193_ar_associations_monkey_patch.rb | lib/rails23_ruby193_ar_associations_monkey_patch.rb | # Finally, we have this innocuous looking patch. Without it, queries like this: current_account.tickets.recent.count
# would instantiate AR objects all (!!) tickets in the account, not merely return a count of the recent ones.
# See https://rails.lighthouseapp.com/projects/8994/tickets/5410-multiple-database-queries-w... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/parse_ideas.rb | lib/parse_ideas.rb | module AllOurIdeas
class Question
include SAXMachine
elements :idea, :as => :ideas#, :class => Idea
element :name, :value => :name
def parse_sample_ideas
q = AllOurIdeas::Question.parse(File.open(RAILS_ROOT+'/ideas.xml'))
end
def add_sample_ideas_to(i)
@question = ::Quest... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/destroy_old_export_job.rb | lib/destroy_old_export_job.rb | DestroyOldExportJob = Struct.new(:export_id)
class DestroyOldExportJob
def perform
Export.memory_safe_destroy(export_id)
end
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/munge_and_notify_job.rb | lib/munge_and_notify_job.rb | MungeAndNotifyJob = Struct.new(:earl_id, :type, :email, :photocracy, :export_key)
class MungeAndNotifyJob
def on_permanent_failure
date_requested = DateTime.iso8601(export_key.split('_')[-2])
IdeaMailer.deliver_export_failed([APP_CONFIG[:ERRORS_EMAIL], email], type, date_requested, photocracy)
end
# mun... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/site_config.rb | lib/site_config.rb | class SiteConfig
def self.set_pairwise_credentials(photocracy=false)
if photocracy
username = APP_CONFIG[:PHOTOCRACY_USERNAME]
password = APP_CONFIG[:PHOTOCRACY_PASSWORD]
else
username = APP_CONFIG[:PAIRWISE_USERNAME]
password = APP_CONFIG[:PAIRWISE_PASSWORD]
end
active_res... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/csv_bridge.rb | lib/csv_bridge.rb | require 'csv'
if CSV.const_defined?(:Reader)
class CSVBridge < FasterCSV
end
else
class CSVBridge < CSV
end
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/lib/extensions/string.rb | lib/extensions/string.rb | # monkey patches to String specific to this application
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/environment.rb | config/environment.rb | # Be sure to restart your server when you modify this file
Encoding.default_external = Encoding.default_internal = Encoding::UTF_8 if defined? Encoding
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.18' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environm... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/routes.rb | config/routes.rb | ActionController::Routing::Routes.draw do |map|
map.resource :session, :controller => "clearance/sessions", :only => [:new, :create, :destroy]
map.signin '/sign_in', :controller => "clearance/sessions", :action => :new
map.signout '/sign_out', :controller => "clearance/sessions", :action => :destroy
map.resourc... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/preinitializer.rb | config/preinitializer.rb | begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
"Run `gem install bundler`... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/boot.rb | config/boot.rb | # Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/geokit.rb | config/initializers/geokit.rb | Geokit::Geocoders::request_timeout = 3
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/01_load_config.rb | config/initializers/01_load_config.rb | extra_conf = "/data/extra-conf/environment-variables.rb"
if File.exists?(extra_conf)
require extra_conf
end
APP_CONFIG = YAML.load(ERB.new(IO.read("#{RAILS_ROOT}/config/config.yml")).result)[RAILS_ENV].symbolize_keys
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/wikipedia_willpaginate_monkeypatch.rb | config/initializers/wikipedia_willpaginate_monkeypatch.rb | class BootstrapPagination < WillPaginate::LinkRenderer
def initialize
@gap_marker = '<li class="disabled gap"><a href="javascript://">…</a></li>'
end
def page_link_or_span(page, span_class, text = nil)
text ||= page.to_s
if span_class.include?('prev_page')
classname = 'prev'
elsif ... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/mysql2_adapter.rb | config/initializers/mysql2_adapter.rb | require 'active_record/connection_adapters/mysql2_adapter'
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/abingo.rb | config/initializers/abingo.rb | require 'redis-store'
Abingo.cache = ActiveSupport::Cache::RedisStore.new "redis://#{REDIS_CONFIG['hostname']}"
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/_load_config.rb | config/initializers/_load_config.rb | REDIS_CONFIG = YAML.load_file("#{Rails.root}/config/redis.yml")
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/time_formats.rb | config/initializers/time_formats.rb | { :short_date => "%x", # 04/13/10
:long_date => "%a, %b %d, %Y" # Tue, Apr 13, 2010
}.each do |k, v|
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update(k => v)
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/flutie_expansion.rb | config/initializers/flutie_expansion.rb | ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :flutie => [
'/flutie/stylesheets/reset',
'/flutie/stylesheets/defaults',
'/flutie/stylesheets/type',
'/flutie/stylesheets/forms',
'/flutie/stylesheets/tables',
'/flutie/stylesheets/lists',
'/flutie/stylesheets/screen'
]
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/errors.rb | config/initializers/errors.rb | require 'net/smtp'
# Example:
# begin
# some http call
# rescue *HTTP_ERRORS => error
# notify_hoptoad error
# end
HTTP_ERRORS = [Timeout::Error,
Errno::EINVAL,
Errno::ECONNRESET,
EOFError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyn... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/session_store.rb | config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Ac... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/rotator.rb | config/initializers/rotator.rb | module Paperclip
class Rotator < Thumbnail
def transformation_command
if rotate_command
super + rotate_command
else
super
end
end
def rotate_command
target = @attachment.instance
if target.rotating?
" -rotate #{target.rotation}"
end
end
... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/new_rails_defaults.rb | config/initializers/new_rails_defaults.rb | # Be sure to restart your server when you modify this file.
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
if defined?(ActiveRecord)
# Include Active Record class name as root for JSON serialized output.
ActiveReco... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/bigdecimal-segfault-fix.rb | config/initializers/bigdecimal-segfault-fix.rb | # Copyright (c) 2009 Michael Koziarski <michael@koziarski.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" ... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/requires.rb | config/initializers/requires.rb | Dir[File.join(RAILS_ROOT, 'lib', 'extensions', '*.rb')].each do |f|
require f
end
Dir[File.join(RAILS_ROOT, 'lib', '*.rb')].each do |f|
require f
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/geoip_city.rb | config/initializers/geoip_city.rb | GEOIP_DB = GeoIP.new(File.join(RAILS_ROOT, 'db/GeoLiteCity.dat'))
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/inflections.rb | config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/locale.rb | config/initializers/locale.rb | I18n.load_path = Dir[Rails.root.join('config', 'locales', 'allourideas', '*.{rb,yml}')]
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/i18n.rb | config/initializers/i18n.rb | I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
I18n.backend.class.send(:include, I18n::Backend::Cache)
I18n.cache_store = ActiveSupport::Cache.lookup_store(:memory_store)
I18n.fallbacks.map('fr' => 'en')
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/bugsnag.rb | config/initializers/bugsnag.rb | Bugsnag.configure do |config|
config.api_key = ENV['AOI_BUGSNAG_API_KEY']
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/delayed_jobs.rb | config/initializers/delayed_jobs.rb | Delayed::Worker.backend = :active_record
Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.sleep_delay = 60
Delayed::Worker.max_attempts = 5
Delayed::Worker.max_run_time = 1.hour
Delayed::Worker.default_priority = 20
class Delayed::Worker
alias_method :original_handle_failed_job, :handle_failed_job
protec... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/mail.rb | config/initializers/mail.rb | # Use config vars to get your Gmail credentials onto Heroku.
# They will be automatically picked up by this file in production.
# heroku config:add GMAIL_EMAIL=dcroak@example.com GMAIL_PASSWORD=password
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:authentication => :plain,... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/noisy_attr_accessible.rb | config/initializers/noisy_attr_accessible.rb | ActiveRecord::Base.class_eval do
def log_protected_attribute_removal(*attributes)
raise "Can't mass-assign these protected attributes: #{attributes.join(', ')}"
end
end
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | SHOULDA_NOISE = %w( shoulda )
FACTORY_GIRL_NOISE = %w( factory_girl )
THOUGHTBOT_NOISE = SHOULDA_NOISE + FACTORY_GIRL_NOISE
Rails.backtrace_cleaner.add_silencer do |line|
THOUGHTBOT_NOISE.any? { |dir| line.include?(dir) }
end
# When debugging, uncomment the next line.
# Rails.backtrace_cleaner.remove_silenc... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/initializers/utf8_monkey_patches.rb | config/initializers/utf8_monkey_patches.rb | unless RUBY_VERSION == '1.8.7'
# Make sure the logger supports encodings properly.
module ActiveSupport
class BufferedLogger
def add(severity, message = nil, progname = nil, &block)
return if @level > severity
message = (message || (block && block.call) || progname).to_s
# If a... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/environments/test.rb | config/environments/test.rb | # Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/environments/cucumber.rb | config/environments/cucumber.rb | # Edit at your own peril - it's recommended to regenerate this file
# in the future when you upgrade to a newer version of Cucumber.
# IMPORTANT: Setting config.cache_classes to false is known to
# break Cucumber's use_transactional_fixtures method.
# For more information see https://rspec.lighthouseapp.com/projects/1... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/environments/development.rb | config/environments/development.rb | # 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... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/environments/staging.rb | config/environments/staging.rb | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
allourideas/allourideas.org | https://github.com/allourideas/allourideas.org/blob/3b586bd3fe23b6a341554bc72ef8a39e2f21a672/config/environments/production.rb | config/environments/production.rb | # Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | ruby | BSD-3-Clause | 3b586bd3fe23b6a341554bc72ef8a39e2f21a672 | 2026-01-04T17:27:38.355655Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/spec/commands_spec.rb | spec/commands_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/helper')
describe "vimdb commands" do
it "lists all commands by default" do
vimdb 'commands'
stdout.must_match /643 rows/
end
it "searches :name field by default" do
vimdb "commands bufd"
stdout.must_match /1 row/
end
it 'lists command nam... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/spec/keys_spec.rb | spec/keys_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/helper')
describe "vimdb keys" do
it "lists all keys by default" do
vimdb 'keys'
stdout.must_match /928 rows/
end
it 'searches :key field by default' do
vimdb "keys g#"
stdout.must_match /1 row/
end
it 'with --mode option ANDs mode to sear... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/spec/helper.rb | spec/helper.rb | gem 'minitest' unless ENV['NO_RUBYGEMS']
require 'minitest/autorun'
require 'vimdb'
require 'fileutils'
require 'bahia'
ENV['VIMDB_RC'] = File.dirname(__FILE__) + '/.vimdbrc'
ENV['VIMDB_DB'] = File.dirname(__FILE__) + '/vimdb.pstore'
ENV['VIMDB_FIXTURE_DIR'] = File.dirname(__FILE__) + '/fixtures'
class MiniTest::Unit... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/spec/common_search_options_spec.rb | spec/common_search_options_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/helper')
describe "common search options" do
it "with --field option searches another field" do
vimdb 'keys L-z -f=desc'
stdout.must_match /^0 rows/
end
it "with --reverse_sort option reverse sorts field" do
vimdb 'keys -R'
stdout.must_match /g... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/spec/runner_spec.rb | spec/runner_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/helper')
require 'tempfile'
describe Vimdb::Runner do
describe "commands" do
it "--help prints help" do
vimdb '--help'
stdout.must_match /^Usage: vimdb \[OPTIONS\] COMMAND.*commands.*keys.*options/m
end
it "no arguments prints help" do
... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/spec/options_spec.rb | spec/options_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/helper')
describe "vimdb options" do
it "lists all options by default" do
vimdb 'options'
stdout.must_match /359 rows/
end
it 'searches :name field by default' do
vimdb "options wildignorec"
stdout.must_match /1 row/
end
end
| ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb.rb | lib/vimdb.rb | module Vimdb
autoload :Runner, 'vimdb/runner'
autoload :User, 'vimdb/user'
autoload :DB, 'vimdb/db'
autoload :Item, 'vimdb/item'
class << self; attr_accessor :default_item, :vim, :plugins_dir; end
self.default_item = 'keys'
self.vim = 'vim'
self.plugins_dir = 'bundle'
def self.user(item_name... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/version.rb | lib/vimdb/version.rb | module Vimdb
VERSION = '0.5.1'
end
| ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/db.rb | lib/vimdb/db.rb | require 'pstore'
module Vimdb
class DB
attr_accessor :file
def initialize(file = ENV['VIMDB_DB'] || Dir.home + '/.vimdb.pstore')
@file = file
@db = PStore.new(@file)
end
def get(key)
@db.transaction(true) { @db[key] }
end
def set(key, value)
@db.transaction { @db[key... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/item.rb | lib/vimdb/item.rb | require 'tempfile'
module Vimdb
class Item
def self.inherited(mod)
(@descendants ||= []) << mod
end
def self.instance(name)
item = @descendants.find {|e| e.item_name == name } or
abort "Item '#{name}' not found"
item.new
end
def self.item_name
name[/\w+$/].downca... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/options.rb | lib/vimdb/options.rb | class Vimdb::Options < Vimdb::Item
def fields
[:name, :alias, :desc]
end
def info
"Created using :help option-list"
end
def create
file = tempfile(:options_help) do |file|
vim 'silent help option-list', 'exe "normal 2_y}"', 'new',
'exe "normal p"', "silent! w! #{file}"
end
... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/keys.rb | lib/vimdb/keys.rb | class Vimdb::Keys < Vimdb::Item
class << self; attr_accessor :config end
self.config = {
modifiers: {'<Esc>' => 'E'},
mode_map: {'!' => 'ci', 'v' => 'vs', 'x' => 'v', 'l' => 'ci'},
}
def initialize
@modifiers, @mode_map = self.class.config.values_at(:modifiers, :mode_map)
@plugins_dir = Vimdb.p... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/runner.rb | lib/vimdb/runner.rb | require 'boson/runner'
require 'hirb'
ENV['BOSONRC'] = ENV['VIMDB_RC'] || '~/.vimdbrc'
class Vimdb::Runner < Boson::Runner
def self.common_search_options
option :reload, :type => :boolean, :desc => 'reloads items'
option :sort, :type => :string, :desc => 'sort by field'
option :reverse_sort, :type => :b... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/commands.rb | lib/vimdb/commands.rb | class Vimdb::Commands < Vimdb::Item
def initialize
@plugins_dir = Vimdb.plugins_dir
end
def create
cmds = parse_index_file create_index_file
cmds + parse_command_file(create_command_file)
end
def create_index_file
tempfile(:commands_index) do |file|
vim 'silent help index.txt', "silent... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
cldwalker/vimdb | https://github.com/cldwalker/vimdb/blob/05c00d3aaaff0f34980fe26af73bccece111766d/lib/vimdb/user.rb | lib/vimdb/user.rb | module Vimdb
class User
def initialize(item, db)
@item, @db = item, db
@reload = !File.exists?(@db.file)
end
def items
!@reload && @db.get(@item.key) ||
@db.set(@item.key, @item.create).tap { @reload = false }
end
def search(query, options = {})
results = @item.se... | ruby | MIT | 05c00d3aaaff0f34980fe26af73bccece111766d | 2026-01-04T17:32:17.679002Z | false |
knife-block/knife-block | https://github.com/knife-block/knife-block/blob/9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524/test/unit/knifeblock_test.rb | test/unit/knifeblock_test.rb | # Tests for knifeblock
#
# Copyright (c) 2012 Green and Secure IT Limited / Matthew Macdonald-Wallace
require 'chef/knife'
require './lib/chef/knife/block'
require 'test/unit'
require 'fileutils'
class TestGreenAndSecureModule < Test::Unit::TestCase
def setup
@green = Object.new
class << @green
inclu... | ruby | MIT | 9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524 | 2026-01-04T17:32:15.592198Z | false |
knife-block/knife-block | https://github.com/knife-block/knife-block/blob/9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524/lib/knife-block.rb | lib/knife-block.rb | ruby | MIT | 9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524 | 2026-01-04T17:32:15.592198Z | false | |
knife-block/knife-block | https://github.com/knife-block/knife-block/blob/9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524/lib/chef/knife/block.rb | lib/chef/knife/block.rb | # knife-block - a plugin to enable the use of multiple knife configuration files
# to allow interaction with multiple knife servers in an easy and consistent manner
#
# Based on a bash script by Kristian Van Der Vliet (vanders@liqwyd.com)
#
# Copyright (c) Matthew Macdonald-Wallace / Green and Secure IT Limited 2012
#
... | ruby | MIT | 9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524 | 2026-01-04T17:32:15.592198Z | false |
knife-block/knife-block | https://github.com/knife-block/knife-block/blob/9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524/lib/knife-block/version.rb | lib/knife-block/version.rb | module Knife
module Block
VERSION = "0.2.1"
end
end
| ruby | MIT | 9ee7f991c7f8400b608e65f6dffa0bd4cf1b2524 | 2026-01-04T17:32:15.592198Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/key_spec.rb | spec/key_spec.rb | require "spec_helper"
describe Redistat::Key do
include Redistat::Database
before(:each) do
db.flushdb
@scope = "PageViews"
@label = "about_us"
@label_hash = Digest::SHA1.hexdigest(@label)
@date = Time.now
@key = Redistat::Key.new(@scope, @label, @date, {:depth => :hour})
end
it "shou... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/result_spec.rb | spec/result_spec.rb | require "spec_helper"
describe Redistat::Result do
it "should should initialize properly" do
options = {:from => "from", :till => "till"}
result = Redistat::Result.new(options)
result.from.should == "from"
result.till.should == "till"
end
it "should have set_or_incr method" do
result = Redi... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/buffer_spec.rb | spec/buffer_spec.rb | require "spec_helper"
describe Redistat::Buffer do
before(:each) do
@class = Redistat::Buffer
@buffer = Redistat::Buffer.instance
@key = mock('Key', :to_s => "Scope/label:2011")
@stats = {:count => 1, :views => 3}
@depth_limit = :hour
@opts = {:enable_grouping => true}
end
# let's clea... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/database_spec.rb | spec/database_spec.rb | require "spec_helper"
describe Redistat::Database do
include Redistat::Database
it "should make #db method available when included" do
db.should == Redistat.redis
end
end
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/model_helper.rb | spec/model_helper.rb | require "redistat"
class ModelHelper1
include Redistat::Model
end
class ModelHelper2
include Redistat::Model
depth :day
store_event true
hashed_label true
end
class ModelHelper3
include Redistat::Model
connect_to :port => 8379, :db => 14
end
class ModelHelper4
include Redistat::Model
scope ... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/synchronize_spec.rb | spec/synchronize_spec.rb | require "spec_helper"
module Redistat
describe Synchronize do
let(:klass) { Synchronize }
describe '.included' do
it 'includes InstanceMethods in passed object' do
base = mock('Base')
base.should_receive(:include).with(klass::InstanceMethods)
klass.included(base)
end
... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/scope_spec.rb | spec/scope_spec.rb | require "spec_helper"
describe Redistat::Scope do
include Redistat::Database
before(:all) do
db.flushdb
end
before(:each) do
@name = "PageViews"
@scope = Redistat::Scope.new(@name)
end
it "should initialize properly" do
@scope.to_s.should == @name
end
it "should increment next_id" d... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/finder_spec.rb | spec/finder_spec.rb | require "spec_helper"
describe Redistat::Finder do
include Redistat::Database
before(:each) do
db.flushdb
@scope = "PageViews"
@label = "about_us"
@date = Time.now
@key = Redistat::Key.new(@scope, @label, @date, {:depth => :day})
@stats = {"views" => 3, "visitors" => 2}
@two_hours_ago ... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/model_spec.rb | spec/model_spec.rb | require "spec_helper"
require "model_helper"
describe Redistat::Model do
include Redistat::Database
before(:each) do
@time = Time.utc(2010, 8, 28, 12, 0, 0)
ModelHelper1.redis.flushdb
ModelHelper2.redis.flushdb
ModelHelper3.redis.flushdb
ModelHelper4.redis.flushdb
end
it "should should na... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/connection_spec.rb | spec/connection_spec.rb | require "spec_helper"
include Redistat
describe Redistat::Connection do
before(:each) do
@redis = Redistat.redis
end
it "should have a valid Redis client instance" do
Redistat.redis.should_not be_nil
end
it "should have initialized custom testing connection" do
@redis.client.host.should == '12... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/summary_spec.rb | spec/summary_spec.rb | require "spec_helper"
describe Redistat::Summary do
include Redistat::Database
before(:each) do
db.flushdb
@scope = "PageViews"
@label = "about_us"
@date = Time.now
@key = Redistat::Key.new(@scope, @label, @date, {:depth => :day})
@stats = {"views" => 3, "visitors" => 2}
@expire = {:ho... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/label_spec.rb | spec/label_spec.rb | require "spec_helper"
describe Redistat::Label do
include Redistat::Database
before(:each) do
db.flushdb
@name = "about_us"
@label = Redistat::Label.new(@name)
end
it "should initialize properly and SHA1 hash the label name" do
@label.name.should == @name
@label.hash.should == Digest::SHA... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/collection_spec.rb | spec/collection_spec.rb | require "spec_helper"
describe Redistat::Collection do
it "should initialize properly" do
options = {:from => "from", :till => "till", :depth => "depth"}
result = Redistat::Collection.new(options)
result.from.should == options[:from]
result.till.should == options[:till]
result.depth.should == op... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/event_spec.rb | spec/event_spec.rb | require "spec_helper"
describe Redistat::Event do
include Redistat::Database
before(:each) do
db.flushdb
@scope = "PageViews"
@label = "about_us"
@label_hash = Digest::SHA1.hexdigest(@label)
@stats = {'views' => 1}
@meta = {'user_id' => 239}
@options = {:depth => :hour}
@date = Tim... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/date_spec.rb | spec/date_spec.rb | require "spec_helper"
describe Redistat::Date do
it "should initialize from Time object" do
now = Time.now
[Redistat::Date.new(now), now.to_rs].each do |rdate|
Redistat::Date::DEPTHS.each { |k| rdate.send(k).should == now.send(k) }
end
end
it "should initialize from Date object" do
today ... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/spec_helper.rb | spec/spec_helper.rb | # add project-relative load paths
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'simplecov'
SimpleCov.start do
add_filter '/spec'
add_filter '/vendor'
end
# require stuff
require 'redistat'
require 'rspec'
require 'rspec/autorun'
# use the t... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/options_spec.rb | spec/options_spec.rb | require "spec_helper"
describe Redistat::Options do
before(:each) do
@helper = OptionsHelper.new
@helper.parse_options(:wtf => 'dude', :foo => 'booze')
end
it "should #parse_options" do
@helper.options[:hello].should == 'world'
@helper.options[:foo].should == 'booze'
@helper.options[:wtf].s... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/thread_safety_spec.rb | spec/thread_safety_spec.rb | require "spec_helper"
describe "Thread-Safety" do
include Redistat::Database
before(:each) do
db.flushdb
end
#TODO should have more comprehensive thread-safe tests
it "should incr in multiple threads" do
threads = []
50.times do
threads << Thread.new {
db.incr("spec:incr")
... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/finder/date_set_spec.rb | spec/finder/date_set_spec.rb | require "spec_helper"
describe Redistat::Finder::DateSet do
before(:all) do
@finder = Redistat::Finder::DateSet.new
end
it "should initialize properly" do
t_start = Time.utc(2010, 8, 28, 22, 54, 57)
t_end = Time.utc(2013, 12, 4, 22, 52, 3)
result = Redistat::Finder::DateSet.new(t_start, t_end)
... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/spec/core_ext/hash_spec.rb | spec/core_ext/hash_spec.rb | require "spec_helper"
describe Hash do
it "should #set_or_incr values" do
hash = {:count => 1}
hash.set_or_incr(:sum, 3).should be_true
hash.should == {:count => 1, :sum => 3}
hash.set_or_incr(:count, 4).should be_true
hash.should == {:count => 5, :sum => 3}
hash.set_or_incr(:count, 'test').... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat.rb | lib/redistat.rb |
require 'rubygems'
require 'date'
require 'time'
require 'digest/sha1'
require 'monitor'
# Active Support 2.x or 3.x
require 'active_support'
if !{}.respond_to?(:with_indifferent_access)
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/hash/reverse_merge'
end
require 'ti... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/collection.rb | lib/redistat/collection.rb | module Redistat
class Collection < ::Array
attr_accessor :from
attr_accessor :till
attr_accessor :depth
attr_accessor :total
def initialize(options = {})
@from = options[:from] ||= nil
@till = options[:till] ||= nil
@depth = options[:depth] ||= nil
end
def total
... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/version.rb | lib/redistat/version.rb | module Redistat
VERSION = "0.5.0"
end
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/event.rb | lib/redistat/event.rb | module Redistat
class Event
include Database
include Options
attr_reader :id
attr_reader :key
attr_accessor :stats
attr_accessor :meta
def default_options
{ :depth => :hour,
:store_event => false,
:connection_ref => nil,
:enable_grouping => true,
:l... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/core_ext.rb | lib/redistat/core_ext.rb | require 'redistat/core_ext/bignum'
require 'redistat/core_ext/date'
require 'redistat/core_ext/fixnum'
require 'redistat/core_ext/hash'
require 'redistat/core_ext/time'
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/result.rb | lib/redistat/result.rb | require 'active_support/core_ext/hash/indifferent_access'
module Redistat
class Result < HashWithIndifferentAccess
attr_accessor :from
attr_accessor :till
alias :date :from
alias :date= :from=
def initialize(options = {})
@from = options[:from] ||= nil
@till = options[:till] ||= ni... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/finder.rb | lib/redistat/finder.rb | require 'redistat/finder/date_set'
module Redistat
class Finder
include Database
class << self
def find(*args)
new.find(*args)
end
def scope(scope)
new.scope(scope)
end
def label(label)
new.label(label)
end
def dates(from, till)
ne... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/key.rb | lib/redistat/key.rb | module Redistat
class Key
include Database
include Options
def default_options
{ :depth => :hour }
end
def initialize(scope, label_name = nil, time_stamp = nil, opts = {})
parse_options(opts)
self.scope = scope
self.label = label_name if !label_name.nil?
self.date =... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/scope.rb | lib/redistat/scope.rb | module Redistat
class Scope
include Database
def initialize(name)
@name = name.to_s
end
def to_s
@name
end
def next_id
db.incr("#{@name}#{KEY_NEXT_ID}")
end
end
end
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/connection.rb | lib/redistat/connection.rb | require 'monitor'
module Redistat
module Connection
REQUIRED_SERVER_VERSION = "1.3.10"
MIN_EXPIRE_SERVER_VERSION = "2.1.3"
# TODO: Create a ConnectionPool instance object using Sychronize mixin to replace Connection class
class << self
# TODO: clean/remove all ref-less connections
de... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/summary.rb | lib/redistat/summary.rb | module Redistat
class Summary
include Database
class << self
def default_options
{
:enable_grouping => true,
:label_indexing => true,
:connection_ref => nil,
:expire => {}
}
end
def buffer
Redistat.buffer
end... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/model.rb | lib/redistat/model.rb | module Redistat
module Model
include Database
include Options
def self.included(base)
base.extend(self)
end
#
# statistics store/fetch methods
#
def store(label, stats = {}, date = nil, opts = {}, meta = {})
Event.new(self.name, label, date, stats, options.merge(opts), ... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/date.rb | lib/redistat/date.rb | module Redistat
class Date
attr_accessor :year
attr_accessor :month
attr_accessor :day
attr_accessor :hour
attr_accessor :min
attr_accessor :sec
attr_accessor :usec
attr_accessor :depth
DEPTHS = [:year, :month, :day, :hour, :min, :sec, :usec]
def initialize(input, depth = ni... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/buffer.rb | lib/redistat/buffer.rb | require 'redistat/core_ext/hash'
module Redistat
class Buffer
include Synchronize
def self.instance
@instance ||= self.new
end
def size
synchronize do
@size ||= 0
end
end
def size=(value)
synchronize do
@size = value
end
end
def count
... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/label.rb | lib/redistat/label.rb | module Redistat
class Label
include Database
include Options
def default_options
{ :hashed_label => false }
end
def self.create(name, opts = {})
self.new(name, opts).save
end
def self.join(*args)
args = args.map {|i| i.to_s}
self.new(args.reject {|i| i.blank? }.j... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/finder/date_set.rb | lib/redistat/finder/date_set.rb | module Redistat
class Finder
class DateSet < Array
def initialize(start_date = nil, end_date = nil, depth = nil, interval = false)
if !start_date.nil? && !end_date.nil?
find_date_sets(start_date, end_date, depth, interval)
end
end
def find_date_sets(start_date, end_da... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/core_ext/time.rb | lib/redistat/core_ext/time.rb | class Time
include Redistat::DateHelper
end
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/core_ext/fixnum.rb | lib/redistat/core_ext/fixnum.rb | class Fixnum
include Redistat::DateHelper
def to_time
Time.at(self)
end
end
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/core_ext/bignum.rb | lib/redistat/core_ext/bignum.rb | class Bignum
include Redistat::DateHelper
def to_time
Time.at(self)
end
end
| ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
jimeh/redistat | https://github.com/jimeh/redistat/blob/4c6a6732bfb4d48266b54cc5f4e695be5ebc0122/lib/redistat/core_ext/hash.rb | lib/redistat/core_ext/hash.rb | class Hash
def merge_and_incr(hash)
self.clone.merge_and_incr!(hash)
end
def merge_and_incr!(hash)
raise ArgumentError unless hash.is_a?(Hash)
hash.each do |key, value|
self[key] = value unless self.set_or_incr(key, value)
end
self
end
def set_or_incr(key, value)
return false ... | ruby | MIT | 4c6a6732bfb4d48266b54cc5f4e695be5ebc0122 | 2026-01-04T17:32:22.870886Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.