code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
#!/usr/bin/env watchr
# config file for watchr http://github.com/mynyml/watchr
# install: gem install watchr
# run: watch watchr.rb
# note: make sure that you have jstd server running (server.sh) and a browser captured
log_file = File.expand_path(File.dirname(__FILE__) + '/../logs/jstd.log')
`cd ..`
`touch #{log_fil... | Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'data_mapper', '~> 1.2'
gem 'dm-postgres-adapter'
gem 'google-api-client', '>= 0.4.3'
group :development do
gem 'dm-sqlite-adapter', '~> 1.2'
gem 'do_sqlite3', '~> 0.10'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
#!/usr/bin/env watchr
# config file for watchr http://github.com/mynyml/watchr
# install: gem install watchr
# run: watch watchr.rb
# note: make sure that you have jstd server running (server.sh) and a browser captured
log_file = File.expand_path(File.dirname(__FILE__) + '/../logs/jstd.log')
`cd ..`
`touch... | Ruby |
# Simple Jobs
# ===========
require 'java'
java_import Java::MyscheduleQuartzExtraJob::LoggerJob
java_import Java::MyscheduleQuartzExtraJob::ScriptingJob
java_import Java::MyscheduleQuartzExtra::SchedulerTemplate
java_import Java::JavaUtil::Date
java_import Java::JavaLang::System
# Schedule hourly job
scheduler.schedu... | Ruby |
#!/usr/bin/env ruby
##
# Copyright (C) 2012 Hai Bison
#
# See the file LICENSE at the root directory of this project for copying
# permission.
#
require 'optparse'
require 'ostruct'
DESCRIPTION = "
Compress project as a .7z file -- just the source code to publish to community,
not all the files to backup.
"
##
# Pr... | Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented an... | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'data_mapper', '~> 1.2'
gem 'dm-postgres-adapter'
gem 'google-api-client', '>= 0.4.3'
group :development do
gem 'dm-sqlite-adapter', '~> 1.2'
gem 'do_sqlite3', '~> 0.10'
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
class CreateDatasources < ActiveRecord::Migration
def self.up
create_table :datasources do |t|
t.column :name, :string
t.column :rrd, :string
t.column :datatype, :string
t.column :parent_id, :integer
end
end
def self.down
drop_table :datasources
end
end
| Ruby |
class CreateGraphDatasources < ActiveRecord::Migration
def self.up
create_table :graph_datasources do |t|
t.column :graph_id, :integer
t.column :datasource_id, :integer
t.column :negative, :boolean
t.column :sortorder, :integer
end
end
def self.down
drop_table :graph_datasourc... | Ruby |
class CreateTabs < ActiveRecord::Migration
def self.up
create_table :tabs do |t|
t.column :name, :string
t.column :parent_id, :integer
end
end
def self.down
drop_table :tabs
end
end
| Ruby |
class CreateGraphs < ActiveRecord::Migration
def self.up
create_table :graphs do |t|
t.column :title, :string
t.column :vlabel, :string
t.column :width, :integer
t.column :height, :integer
t.column :period, :integer
t.column :upperlimit, :decimal
t.column :lowerlimit, :decimal
t.column :st... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test da... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module GraphitHelper
end
| Ruby |
class Tab < ActiveRecord::Base
acts_as_tree :order => "name"
has_many :graphs, :dependent => :destroy
end
| Ruby |
class GraphDatasource < ActiveRecord::Base
belongs_to :graph
belongs_to :datasource
end
| Ruby |
class Graph < ActiveRecord::Base
belongs_to :tab
has_many :graph_datasources, :dependent => :destroy
has_many :datasources, :through => :graph_datasources, :order => "sortorder ASC", :dependent => :destroy
end
| Ruby |
class Datasource < ActiveRecord::Base
acts_as_tree :order => "name"
has_many :graph_datasources, :dependent => :destroy
has_many :graphs, :through => :graph_datasources, :source => :graph, :order => "sortorder ASC", :dependent => :destroy
end
| Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryPr... | Ruby |
require 'zlib'
require 'base64'
require 'time'
class ShowController < ApplicationController
protect_from_forgery :only => [:update, :destroy]
def index
redirect_to :action => 'tab', :id => 2
end
# Load the main content based on selected tab
def tab
# Simple ACL - put into conf
admins = ['barr... | 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.
# 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 do debug a probl... | 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 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.
Act... | Ruby |
ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | Ruby |
# 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 |
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | Ruby |
# 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
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | Ruby |
# 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 |
# 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 |
# 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.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... | Ruby |
class ErrorInChangingFriendshipsToString < ActiveRecord::Migration
def self.up
remove_column :friendships, :fiend1_id
remove_column :friendships, :friend2_id
add_column :friendships, :friend1_id, :string
add_column :friendships, :friend2_id, :string
end
def self.down
end
end
| Ruby |
class RemoveProejctIdColumn < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class CreateFriendshipSentRequests < ActiveRecord::Migration
def self.up
create_table :friendship_sent_requests do |t|
t.integer :from_user
t.integer :to_user
t.string :message
t.date :sent_date
t.timestamps
end
end
def self.down
drop_table :friendship_sent_requests
e... | Ruby |
class CreateProjectFundings < ActiveRecord::Migration
def self.up
create_table :project_fundings do |t|
t.integer :project_id
t.integer :receiver_id
t.integer :recommender_id
t.integer :donor_id
t.date :funding_date
t.timestamps
end
end
def self.down
drop_table :p... | Ruby |
class CreateTestProducts < ActiveRecord::Migration
def self.up
create_table :test_products do |t|
t.string :title
t.text :description
t.string :image_url
t.decimal :price
t.timestamps
end
end
def self.down
drop_table :test_products
end
end
| Ruby |
class AddHashedPasswordForUser < ActiveRecord::Migration
def self.up
add_column :users, :hashed_password, :string
add_column :users, :salt, :string
end
def self.down
remove_column :users, :hashed_password
remove_coulmn :users, :salt
end
end
| Ruby |
class CreateFriendships < ActiveRecord::Migration
def self.up
create_table :friendships do |t|
t.integer :friend1_id
t.integer :friend2_id
t.date :begin_date
t.string :how_do_you_know
t.timestamps
end
end
def self.down
drop_table :friendships
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :gender
t.string :address_line1
t.string :address_line2
t.string :city
t.string :state
t.integer :zipcode
t.string :email_id
... | Ruby |
class AddingUseridColumToProjects < ActiveRecord::Migration
def self.up
add_column :projects, :user_id, :string
end
def self.down
drop_column :projects, :user_id
end
end
| Ruby |
class AddProjectIdToProjects < ActiveRecord::Migration
def self.up
add_column :projects, :project_id, :integer
end
def self.down
drop_column :projects, :project_id
end
end
| Ruby |
class AlterFriendshipRequestFieldsToString < ActiveRecord::Migration
def self.up
remove_column :friendship_sent_requests, :from_user
remove_column :friendship_sent_requests, :to_user
add_column :friendship_sent_requests, :from_user, :string
add_column :friendship_sent_requests, :to_user, :string
en... | Ruby |
class AddSeenFlagsToDonorRequests < ActiveRecord::Migration
def self.up
add_column :donor_requests, :seen_by_receiver, :boolean
add_column :donor_requests, :seen_by_sender, :boolean
end
def self.down
drop_column :donor_requests, :seen_by_receiver
drop_column :donor_requests, :seen_by_sender
end... | Ruby |
class AddFundingAmountToProjectFundingsTable < ActiveRecord::Migration
def self.up
add_column :project_fundings, :funding_money, :integer
end
def self.down
drop_column :project_fundings, :funding_money
end
end
| Ruby |
class AddPasswordToUser < ActiveRecord::Migration
def self.up
add_column :users, :password,:string
end
def self.down
remove_column :users, :password
end
end
| Ruby |
class CreateReceiverRequests < ActiveRecord::Migration
def self.up
create_table :receiver_requests do |t|
t.integer :project_id
t.boolean :received
t.date :received_date
t.integer :received_money
t.timestamps
end
end
def self.down
drop_table :receiver_requests
end
end
| Ruby |
class DropTableDonorRequests < ActiveRecord::Migration
def self.up
drop_table :donor_requests
end
def self.down
end
end
| Ruby |
class RecreateDonorRequests < ActiveRecord::Migration
def self.up
create_table :donor_requests do |t|
t.integer :project_id
t.boolean :sent
t.boolean :receiver_accepted
t.string :sent_user_id
t.date :sent_date
t.integer :sent_money
t.timestamps
end
end
def self.... | Ruby |
class AddEmailIdToUsers < ActiveRecord::Migration
def self.up
add_column :users, :email_id, :string
end
def self.down
remove_column :users, :email_id
end
end
| Ruby |
class AddSentUserIdCoulmnToDonorRequests < ActiveRecord::Migration
def self.up
add_column :donor_requests, :sent_user_id, :string
end
def self.down
drop_column :donor_requests, :sent_user_id
end
end
| Ruby |
class ChangeIntToStringInFrinedship < ActiveRecord::Migration
def self.up
remove_column :friendships, :fiend1_id
remove_column :friendships, :friend2_id
add_column :friendships, :friend1_id, :string
add_column :friendships, :friend2_id, :string
end
def self.down
end
end
| Ruby |
class AddSponsorReceivedMoneyToDonorRequests < ActiveRecord::Migration
def self.up
add_column :donor_requests, :sponsor_received_money, :boolean
end
def self.down
drop_column :donor_requests, :sponsor_received_money
end
end
| Ruby |
class AddReceiverAcceptedToDonorRequests < ActiveRecord::Migration
def self.up
add_column :donor_requests, :receiver_accepted, :bool
end
def self.down
remove_column :donor_requests, :receiver_accepted
end
end
| Ruby |
class CreateDonorRequests < ActiveRecord::Migration
def self.up
create_table :donor_requests do |t|
t.integer :project_id
t.boolean :sent
t.date :sent_date
t.integer :sent_money
t.timestamps
end
end
def self.down
drop_table :donor_requests
end
end
| Ruby |
class CreateProjects < ActiveRecord::Migration
def self.up
create_table :projects do |t|
t.string :name
t.string :summary
t.text :description
t.integer :minimum_budget
t.integer :maximum_budget
t.integer :days_to_return_money
t.boolean :need_referral
t.timestamps
... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integrati... | Ruby |
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# 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 1.... | Ruby |
module ApplicationHelper
end
| Ruby |
module ProfileHelper
end
| Ruby |
module ReceiverRequestsHelper
end
| Ruby |
module SessionsHelper
end
| Ruby |
module FriendshipsHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module ProjectsHelper
end
| Ruby |
module LogoutHelper
end
| Ruby |
module ProjectFundingsHelper
end
| Ruby |
module TestProductsHelper
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.