code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
def f(x)
x + 1
end
def g(x)
x + 1
end
def h(x)
x + 1
end
def a
1
end
def b
1
end
def c
1
end
Chaining style:
a.
b.
c
a.b.
c
| Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | Ruby |
require 'compass'
Compass::Frameworks.register("sassy-math", :path => "#{File.dirname(__FILE__)}/..")
# Sassy math Functions
module Sass::Script::Functions
# Exponents
def exponent(base, powerNum, powerDen)
base = base.value.to_f
powerNum = powerNum.value.to_f
powerDen = powerDen.value.to_f
result ... | Ruby |
require 'compass'
Compass::Frameworks.register('sassy-math', :path => File.expand_path("../.."))
# This tells Compass what your Compass extension is called, and where to find
# its files
# Replace 'extension' with the name of your extension. Spaces allowed.
extension_path = File.expand_path(File.join(File.dirname(__... | Ruby |
# Require any additional compass plugins here.
# Tell compass where to find local extensions
# If you followed directions and ran 'gem install modular-scale' comment the next two lines out:
extensions_dir = "sass/extensions"
Compass::Frameworks.register('modular-scale', :path => File.expand_path("#{extensions_dir}/mo... | Ruby |
DATA_CENTERS = ["all", "sjc", "ord", "iad", "nyc", "ops"] # TODO: anymore? static or dynamic? | Ruby |
# 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):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
# 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 |
# 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 |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies 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 attac... | Ruby |
# Be sure to restart your server when you modify this file.
Test11::Application.config.session_store :cookie_store, :key => '_test11_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails ... | Ruby |
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | Ruby |
CDR_DATA_FILEROOT = "/usr/voip_metrics/rawcdrs"
CDR_NEWEXT = ".imported"
###########################################################################
##
## => Labels in the hash
##
###########################################################################
RECORD_ID = "record_i... | Ruby |
Test11::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
... | Ruby |
Test11::Application.configure do
# Settings specified here will take precedence over those in config/application.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 webser... | Ruby |
Test11::Application.configure do
# Settings specified here will take precedence over those in config/application.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 s... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
TestPg::Application.initialize!
| Ruby |
AREA = {
"211"=>["--","Local community info / referral services"],
"242"=>["--","Bahamas"],
"246"=>["--","Barbados"],
"264"=>["--","Anguilla (split from 809)"],
"268"=>["--","Antigua and Barbuda (split from 809)"],
"284"=>["--","British Virgin Islands (split from 809)"],
"311"=>["--","Reserved for special appli... | Ruby |
FILEROOT = "/usr/voip_metrics/rawcallcaches"
NL = "\n"
NEWEXT = ".imported"
#SERVER = "127.0.0.1"
USERNAME = "root"
PASSWORD = ""
#DATABASE ="test3_development"
LOG_FILE_NAME = "myLog.log"
DEFAULT_MASK = "11111111111111111111111111111111"
##
# Lables in the array
##
ID = "identifier"
SBC... | Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
#################################################################################
##
## This file contains country name, iso code, country number, and mask that is used to store digits of numbers
## We store only country numbers for most of them except US
## Currently, the mask of US is 0111111, which means 6 digits ex... | Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module TestPg
class Application < Rails::Application
# ... | Ruby |
TestPg::Application.routes.draw do
resources :callcache
resources :callcache_parser
resources :cdr
resources :cdr_parser
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind yo... | Ruby |
#Creates xml with values for sales data of products
#and the quantity of sales in each quarter of a year
#by a combination of differing scales of two y-axes.
#The values required for building the xml is obtained as parameter arr_data
#It expects an array in which each element is
#itself an array with first element as... | Ruby |
xml = Builder::XmlMarkup.new
xml.chart(:showMean=>1, :caption=>"caption", :palette=>"2", :animation=>"1", :formatNumberScale=>"0", \
:numberPrefix=>"", :labeldisplay=>"ROTATE", :slantLabels=>"1", :seriesNameInToolTip=>"0", \
:sNumberSuffix=>" pcs.", :showValues=>"0", :plotSpacePercent=>"0", :labelDisplay=>"STAGGER", :i... | Ruby |
#Creates xml with values for sales data of products
#and the quantity of sales in each quarter of a year
#by a combination of differing scales of two y-axes.
#The values required for building the xml is obtained as parameter arr_data
#It expects an array in which each element is
#itself an array with first element as... | Ruby |
xml = Builder::XmlMarkup.new
xml.chart(\
:showMean=>1, :caption=> caption, :palette=>"2", :animation=>"1", :formatNumberScale=>"0", \
:numberPrefix=>"", :labeldisplay=>"ROTATE", :slantLabels=>"1", :seriesNameInToolTip=>"0", \
:sNumberSuffix=>" pcs.", :showValues=>"0", :plotSpacePercent=>"0", :labelDisplay=>"STAGGER") d... | Ruby |
xml = Builder::XmlMarkup.new
xml.chart(:showMean=>1, :caption=> caption) do
# Run a loop to create the <category> tags within <categories>
xml.categories do
for item in arr_data
xml.category(:name=>item[0])
end
end
# Run a loop to create the <set> tags within dataset for series 'R-factor'
xml... | Ruby |
xml = Builder::XmlMarkup.new
xml.chart(:Caption=>caption, \
:canvasBgColor=>'EFEFEF', \
:showValues=>'1', \
:canvasborderlalpha=>'0', \
:bgcolor=>'FFFFFF', \
:borderalpha=>'0', \
:legendShadow=>'0', \
:legendborderalpha=>'0', \
:legendIconScale=>'1', \
:legendPosition=>'bot... | Ruby |
# Methods added to this helper will be available to all templates in the application.
require "parsedate"
module ApplicationHelper
# Include this module wherever you want to use render_chart, render_chart_html and other functions
# Version 1.5 (August 2010) - Added other parameters as options hash. Added function enabl... | Ruby |
module CdrHelper
def data_format(array)
s ="["
s += array[0].join(',')
for i in 1...array.size
end
s += "]"
end
def my_format(hash)
a = Array.new
for item in hash
a << item[1]
end
return "[" + a.join(',') + "]"
end
end
| Ruby |
module CdrParserHelper
end
| Ruby |
require "json"
require "config/country_number.rb"
require "config/areacode.rb"
module CallcacheParserHelper
end
def test()
@ccode_src.nil?
end
############################################################################################################
##
## Function: rollbackFileName
## This function takes out... | Ruby |
require "config/country_number.rb"
module CallcacheHelper
def remove_dot(ip)
return ip.gsub(".","_")
end
def get_annot(params)
default = 3000
if params[:annot] != nil
begin
value = Integer(params[:annot])
return value
rescue
return default
end
else
... | Ruby |
class FactDestTrunkGroup < ActiveRecord::Base
belongs_to :dimen_trunk_group_carrier
end
| Ruby |
class FactCountByDestIp < ActiveRecord::Base
end
| Ruby |
class ConfigGranularity < ActiveRecord::Base
end
| Ruby |
class FactSrcPhoneNumber < ActiveRecord::Base
belongs_to :dimen_src_location
end
| Ruby |
class FactCountBySrcIp < ActiveRecord::Base
end
| Ruby |
class DimenDestVcb < ActiveRecord::Base
belongs_to :dimen_trunk_group_carrier
end
| Ruby |
class ConfigCurrentGranularityMapping < ActiveRecord::Base
self.primary_key = "iso_country_code"
belongs_to :config_granularity
end
| Ruby |
class DimenTrunkGroupCarrier < ActiveRecord::Base
has_many :fact_dest_trunk_groups
#:class_name => "FactDestTrunkGroup",
#:finder_sql => "select f.*, d.* from dimen_trunk_group_carriers d, fact_dest_trunk_groups f \
# where f.dimen_trunk_group_carrier_id = d.id"
b... | Ruby |
class CdrRaw < ActiveRecord::Base
end
| Ruby |
class DimenSrcLocation < ActiveRecord::Base
has_many :fact_src_phone_numbers
end
| Ruby |
class Test < ActiveRecord::Base
end
| Ruby |
require "app/helpers/application_helper.rb"
require "config/cdr_config.rb"
require 'date'
require 'time'
class CdrController < ApplicationController
layout "cdr_explorer"
def test_chart
response.content_type = Mime::HTML
@arr_data = [["vcb11",56,45,46,32], ["vcb2", 44, 67,34,23], ["vcb3", 23, 89, 90, 45... | Ruby |
require "config/cdr_parser_config.rb"
require "app/helpers/cdr_parser_helper.rb"
require "date"
require "json"
class CdrParserController < ApplicationController
def start
iterate_folders(CDR_DATA_FILEROOT)
end
def view1
end
def iterate_folders(fileroot)
'''
It does depth first search... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, xxxall the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForger... | Ruby |
require "config/callcache_parser_config.rb"
require "app/helpers/callcache_parser_helper.rb"
require "date"
require "json"
require "config/areacode.rb"
require "config/country_number.rb"
class CallcacheParserController < ApplicationController
helper :callcache_parser
############################################... | Ruby |
require "app/helpers/application_helper.rb"
require "app/helpers/callcache_helper.rb"
require "config/cdr_config.rb"
class CallcacheController < ApplicationController
layout "cdr_explorer"
##########################################################################################################
##
## 1. des... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
CdrV1::Application.load_tasks
| Ruby |
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'rspec'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for... | Ruby |
class ChangeColumnConfigGranularityIdDimenSrcLocations < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class AddCallsToFactCountBySrcIp < ActiveRecord::Migration
def self.up
#add_column :fact_count_by_src_ips, :calls, :integer
#add_column :fact_count_by_src_ips, :timestamp, :integer
end
def self.down
remove_column :fact_count_by_src_ips, :timestamp
remove_column :fact_count_by_src_ips, :calls
en... | Ruby |
class ChangeColumnConfigGranularityId2ToDimenSrcLocations < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class CreateDimenDestVcbs < ActiveRecord::Migration
def self.up
create_table :dimen_dest_vcbs do |t|
t.timestamps
end
end
def self.down
drop_table :dimen_dest_vcbs
end
end
| Ruby |
class CreateCallcacheRaws < ActiveRecord::Migration
def self.up
create_table :callcache_raws do |t|
t.string :id
t.string :SBCID
t.integer :timestamp
t.string :src_carrier
t.string :src_ip
t.string :src_phone
t.string :dest_carrier
t.string :dest_ip
t.string :... | Ruby |
class AddColumPhidToDimenSrcLocation < ActiveRecord::Migration
def self.up
add_column :dimen_src_locations, :error_code_from_phid, :string
end
def self.down
remove_column :dimen_src_locations, :error_code_from_phid
end
end
| Ruby |
class AddColumnToCallcacheRaws < ActiveRecord::Migration
def self.up
add_column :callcache_raws, :ccode_src, :string
add_column :callcache_raws, :scode_dest, :string
end
def self.down
remove_column :callcache_raws, :scode_dest
remove_column :callcache_raws, :ccode_src
end
end
| Ruby |
class AddColumnsToDimenDestVcb < ActiveRecord::Migration
def self.up
add_column :dimen_dest_vcbs, :vcb_name, :string
add_column :dimen_dest_vcbs, :vcb_ip, :string
end
def self.down
remove_column :dimen_dest_vcbs, :vcb_ip
remove_column :dimen_dest_vcbs, :vcb_name
end
end
| Ruby |
class AddColumnMaskToDimenSrcLocation < ActiveRecord::Migration
def self.up
add_column :dimen_src_locations, :mask, :string
end
def self.down
remove_column :dimen_src_locations, :mask
end
end
| Ruby |
class CreateConfigCurrentGranularityMappings < ActiveRecord::Migration
def self.up
create_table :config_current_granularity_mappings do |t|
t.timestamps
end
end
def self.down
drop_table :config_current_granularity_mappings
end
end
| Ruby |
class AddColumnRecordIdToCdrRaws < ActiveRecord::Migration
def self.up
add_column :cdr_raws, :record_id, :string
end
def self.down
remove_column :cdr_raws, :record_id
end
end
| Ruby |
class AddColumnsToFactDestTrunkGroup < ActiveRecord::Migration
def self.up
add_column :fact_dest_trunk_groups, :dimen_trunk_group_id, :integer
add_column :fact_dest_trunk_groups, :timestamp, :integer
add_column :fact_dest_trunk_groups, :calls, :integer
end
def self.down
remove_column :fact_dest_t... | Ruby |
class AddColumnToDimenSrcLocation < ActiveRecord::Migration
def self.up
add_column :dimen_src_locations, :src_carrier, :string
add_column :dimen_src_locations, :src_ip, :string
end
def self.down
remove_column :dimen_src_locations, :src_ip
remove_column :dimen_src_locations, :src_carrier
end
end... | Ruby |
class DimenDestVcb < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class AddCallsToFactCountByDestIp < ActiveRecord::Migration
def self.up
add_column :fact_count_by_dest_ips, :calls, :integer
end
def self.down
remove_column :fact_count_by_dest_ips, :calls
end
end
| Ruby |
class CreateDimenTrunkGroupCarriers < ActiveRecord::Migration
def self.up
create_table :dimen_trunk_group_carriers do |t|
t.timestamps
end
end
def self.down
drop_table :dimen_trunk_group_carriers
end
end
| Ruby |
class AddColumnVcbDataCenterToDimenDestVcbs < ActiveRecord::Migration
def self.up
add_column :dimen_dest_vcbs, :vcb_data_center, :string
end
def self.down
remove_column :dimen_dest_vcbs, :vcb_data_center
end
end
| Ruby |
class AlterColumnsDimenTrunkGroupCarriers < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class AddColumnToCdrRaws < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class AddColumnAreacodeForUsToDimenSrcLocations < ActiveRecord::Migration
def self.up
add_column :dimen_src_locations, :areacode_for_us, :string
end
def self.down
remove_column :dimen_src_locations, :areacode_for_us
end
end
| Ruby |
class CreateTableCdrRaws < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class ChangeColumnFactDestTrunkGroup < ActiveRecord::Migration
def self.up
rename_column :fact_dest_trunk_groups, :dimen_trunk_group_id, :dimen_trunk_group_carrier_id
end
def self.down
end
end
| Ruby |
class CreateCdrRaws < ActiveRecord::Migration
def self.up
create_table :cdr_raws do |t|
t.timestamps
end
end
def self.down
drop_table :cdr_raws
end
end
| Ruby |
class AddToDimenDestVcb < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class ChangeIndentifyingPhoneNumberFactCountByDestNumber < ActiveRecord::Migration
def self.up
remove_column :fact_count_by_dest_numbers, :indentifying_phone_number
add_column :fact_count_by_dest_numbers, :identifying_phone_number, :string
end
def self.down
end
end
| Ruby |
class AddColumnStateToDimenSrcLocation < ActiveRecord::Migration
def self.up
add_column :dimen_src_locations, :state, :string
end
def self.down
remove_column :dimen_src_locations, :state
end
end
| Ruby |
class CreateFactCountByDestIps < ActiveRecord::Migration
def self.up
create_table :fact_count_by_dest_ips do |t|
t.string :dest_ip
t.integer :timestamp
t.timestamps
end
end
def self.down
drop_table :fact_count_by_dest_ips
end
end
| Ruby |
class AddColumnSrcCcodeToCallcacheRaws < ActiveRecord::Migration
def self.up
remove_column :callcache_raws, :ccode_src
remove_column :callcache_raws, :scode_dest
add_column :callcache_raws, :src_ccode, :string
add_column :callcache_raws, :dest_ccode, :string
end
def self.down
remove_column :c... | Ruby |
class RemoveColumnConfigGranularityIdFromDimenTrunkGroupCarrier < ActiveRecord::Migration
def self.up
remove_column :dimen_src_locations, :config_granularity_id
end
def self.down
end
end
| Ruby |
class AddColumnIdentifierToCallcacheRaws < ActiveRecord::Migration
def self.up
add_column :callcache_raws, :identifier, :string
end
def self.down
remove_column :callcache_raws, :identifier
end
end
| Ruby |
class CreateTests < ActiveRecord::Migration
def self.up
create_table :tests do |t|
t.timestamps
end
end
def self.down
drop_table :tests
end
end
| Ruby |
class ChangeColumnDimenTrunkGroupCarriers < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class AlterColumnDimenTrunkGroupCarriers < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class CreateFactDestTrunkGroups < ActiveRecord::Migration
def self.up
create_table :fact_dest_trunk_groups do |t|
t.timestamps
end
end
def self.down
drop_table :fact_dest_trunk_groups
end
end
| Ruby |
class AddColumnIsoCountryCodeToDimenTrunkGroupCarriers < ActiveRecord::Migration
def self.up
add_column :dimen_trunk_group_carriers, :iso_country_code, :string
end
def self.down
remove_column :dimen_trunk_group_carriers, :iso_country_code
end
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.