code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/bin/env ruby class ExampleRemoteLibrary def count_items_in_directory(path) Dir.entries(path).find_all{|i| not i.match('^\.')}.length end def strings_should_be_equal(str1, str2) puts "Comparing '#{str1}' to '#{str2}'" if str1 != str2 raise RuntimeError, "Given strings are not equal" ...
Ruby
class RubyLibraryExample def get_server_language 'ruby' end # Basic communication def passing end def failing(message) raise message end def logging(message, level='INFO') puts "*#{level}* #{message}" end def returning 'returned string' end # Logging def one_message_w...
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
# coding: utf-8 # Title: LightPack API wrapper for Ruby # Author: Mikhail S. Pobolovets # License: GPL v3 # Date: 2011/08/15 # API Version: 5.5 require 'socket' class LightPack include Socket::Constants # host = '127.0.0.1' # The remote host # port = 3636 ...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 project = 'battery-indicator' user = `cat ~/.netrc | awk '{print $4;}'`.strip pass = `cat ~/.netrc | awk '{print $6;}'`.strip version = `grep "android:versionName=" AndroidManifest.xml`.split('"')[1] apk_location = "BatteryIndicatorPro-#{version}.apk" system("cp bin/*-release.ap...
Ruby
#!/usr/bin/env ruby require 'net/http' require 'uri' LANGS_URI = 'http://ath.darshancomputing.com/bi/langs/' langs = Net::HTTP.get(URI.parse(LANGS_URI)).split() langs.each do |lang| if lang.length == 2 dir = 'res/values-' << lang else dir = 'res/values-' << lang[0,2] << '-r' << lang[2,2] end if ! D...
Ruby
#!/usr/bin/env ruby require 'nokogiri' string_to_remove = ['pref_cat_themes', 'theme_settings', 'theme_settings_summary', 'theme_settings_help'] string_files = [] Dir.glob('res/values*').each do |d| file = d << "/strings.xml" string_files << file if Fil...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 require 'nokogiri' # read in convert.xml to see which how to convert the string-arrays # for each strings.xml in res/values res/values-?? res/values-??-* # find the string-arrays that match the ones in convert.xml and for each # remove opening and closing string-array tag #...
Ruby
require 'RMagick' class NumberImageGenerator @@IMAGE_DIR = 'numbers-hdpi/' def generate(text, fs=18) #filename = "b" + sprintf("%03d", text) + ".png"; filename = "" + sprintf("%03d", text) + ".png"; font_size = fs; height = 35; width = 35; image = Magick::Image.new(width, height) {self.ba...
Ruby
# coding: utf-8 # Title: LightPack API wrapper for Ruby # Author: Mikhail S. Pobolovets # License: GPL v3 # Date: 2011/08/15 # API Version: 5.5 require 'socket' class LightPack include Socket::Constants # host = '127.0.0.1' # The remote host # port = 3636 ...
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
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
class CreateDatProjects < ActiveRecord::Migration def self.up create_table :dat_projects do |t| t.string "project_cd", :null => false t.string "project_name", :null => false t.date "start_date" t.date "delivery_date" t.integer "valid_f...
Ruby
class CreateDatTaskusers < ActiveRecord::Migration def self.up create_table :dat_taskusers do |t| t.integer "task_id", :null => false t.integer "projectuser_id", :null => false t.integer "create_user_id", :null => false t.datetime "created_on", :null => false end end ...
Ruby
class CreateDatTaskhistories < ActiveRecord::Migration def self.up create_table :dat_taskhistories do |t| t.integer "task_id", :null => false t.string "msg_code", :limit => 20, :null => false t.text "content", :null => false t.integer ...
Ruby
class CreateMstMessages < ActiveRecord::Migration def self.up create_table :mst_messages do |t| t.string "msg_code", :null => false t.integer "msg_kbn", :null => false t.text "msg_base", :null => false t.text "msg_j...
Ruby
class CreateMstUsers < ActiveRecord::Migration def self.up create_table :mst_users do |t| t.string "login_id" t.string "password", :null => false t.string "user_name", :null => false t.string "email", ...
Ruby
class CreateDatEvents < ActiveRecord::Migration def self.up create_table :dat_events do |t| t.integer "project_tree_id", :null => false t.date "start_date" t.time "start_time" t.date "end_date" t.time "end_time" t.integer "alld...
Ruby
class CreateDatTaskcmts < ActiveRecord::Migration def self.up create_table :dat_taskcmts do |t| t.integer "task_id", :null => false t.text "comment", :null => false t.integer "create_user_id", :null => false t.datetime "created_on", :null => false end end d...
Ruby
class CreateDatMilestones < ActiveRecord::Migration def self.up create_table :dat_milestones do |t| t.integer "project_tree_id", :null => false t.date "mils_date" t.integer "create_user_id", :null => false t.datetime "created_on", :null => false t.integer "updat...
Ruby
class CreateMstTptasks < ActiveRecord::Migration def self.up create_table :mst_tptasks do |t| t.integer "template_tree_id", :null => false t.float "plan_power", :default => 0.0 t.integer "tani_kbn", :default => 2 t.text "memo" t.integer "creat...
Ruby
class CreateMstTpevents < ActiveRecord::Migration def self.up create_table :mst_tpevents do |t| t.integer "template_tree_id", :null => false t.string "place", :limit => 100 t.text "content" t.integer "create_user_id", :null => false ...
Ruby
class CreateDatEventfiles < ActiveRecord::Migration def self.up create_table :dat_eventfiles do |t| t.integer "event_id", :null => false t.string "file_name", :limit => 40, :null => false t.string "file_path", :null => false t.integer "crea...
Ruby
class CreateMstTpmilestones < ActiveRecord::Migration def self.up create_table :mst_tpmilestones do |t| t.integer "template_tree_id", :null => false t.integer "create_user_id", :null => false t.datetime "created_on", :null => false t.integer "update_user_id", :null => false ...
Ruby
class CreateMstCompositions < ActiveRecord::Migration def self.up create_table :mst_compositions do |t| t.integer "template_id", :null => false t.integer "line_no", :null => false t.integer "task_kbn", :null => false t.string "item_name", :null => false t.st...
Ruby
class CreateDatTasks < ActiveRecord::Migration def self.up create_table :dat_tasks do |t| t.integer "project_tree_id", :null => false t.integer "priority_kbn", :default => 2, :null => false t.float "plan_power", :default => 0.0, :null => false t.flo...
Ruby
class CreateDatTaskfiles < ActiveRecord::Migration def self.up create_table :dat_taskfiles do |t| t.integer "task_id", :null => false t.string "file_name", :limit => 40, :null => false t.string "file_path", :null => false t.integer "create...
Ruby
class CreateDatProjectlogs < ActiveRecord::Migration def self.up create_table :dat_projectlogs do |t| t.integer "projectcomp_id", :null => false t.integer "log_kbn", :null => false t.integer "create_user_id", :null => false t.datetime "created_on", :null => false end en...
Ruby
class CreateDatProjectcomps < ActiveRecord::Migration def self.up create_table :dat_projectcomps do |t| t.integer "project_id", :null => false t.integer "line_no", :null => false t.integer "task_kbn", :null => false t.string "item_name", :null => ...
Ruby
class UpdateDatTaskHistoriesReportDate < ActiveRecord::Migration def self.up add_column :dat_taskhistories, :report_date, :date end def self.down end end
Ruby
class CreateMstTemplates < ActiveRecord::Migration def self.up create_table :mst_templates do |t| t.string "type_name", :limit => 40 t.string "template_name", :limit => 100, :null => false t.text "memo" t.integer "valid_flg", :default => 1,...
Ruby
class CreateDatEventusers < ActiveRecord::Migration def self.up create_table :dat_eventusers do |t| t.integer "event_id", :null => false t.integer "projectuser_id", :null => false t.integer "entry_flg", :default => 0, :null => false t.integer "c...
Ruby
class CreateDatProjectusers < ActiveRecord::Migration def self.up create_table :dat_projectusers do |t| t.integer "project_id", :null => false t.string "email", :limit => 40, :null => false t.integer "user_id" t.integer "create_...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::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 datab...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.lo...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/local/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.lo...
Ruby
#!/usr/local/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impai...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
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' 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/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/generate'
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' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
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/about'
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/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/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
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/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
module CalendarHelper def open_calender(element) return link_to(image_tag("icon-calendar.gif", :border => 0), "javascript:dispCal('" + element + "');") end end
Ruby
# Methods added to this helper will be available to all templates in the application. require_dependency 'jsmin' module ApplicationHelper include AppFormHelper # #=== ローカライズ文字列を返す # #指定されたメッセージ区分とメッセージコードに該当する #ローカライズされた文字列を返す。 # def app_localized_message(msg_kbn, msg_code) if @app_messages_has...
Ruby
# -*- coding: utf-8 -*- module ProjectHelper include ApplicationHelper include AppFormHelper include ERB::Util # #=== プロジェクト名のリンクタグを返す # #指定されたプロジェクトオブジェクトから #該当のプロジェクト名のリンクタグを返す # def link_project_name(project, options="") to = {:controller=>:project, :action=>:index, :id=>project.id} lin...
Ruby
module EventHelper # #=== ユーザー一覧のプルダウンを返す # #イベントに参加可能なユーザーのSELECTタグを出力する。 # def select_for_eventusers(variable, attribute, options, html_options) # ユーザー一覧のプルダウンを出力 insobj = instance_variable_get("@#{variable}") if insobj == nil select( variable, attribute, {}, options, html_options) ...
Ruby
module LoginHelper end
Ruby
module AppFormHelper # #=== 日付入力フィールドタグ文字列を返す # #日付ピックアップダイアログのアイコンを持つ #日付入力フィールドのタグを出力する。 # def date_field(object_name, method, options = {}) content_for(:for_ext_scripts) do opt = {:format => 'Y-m-d'} apply_ext((object_name.to_s+'_'+method.to_s), 'Ext.form.DateField', opt) end ...
Ruby
# -*- coding: utf-8 -*- module TaskHelper # #=== プロジェクト選択プルダウンを返す # #参加可能なプロジェクトのSELECTタグを出力する。 # def select_for_projects(variable, attribute, projectcomp, projects, options, html_options) if projectcomp.id.nil? || projectcomp.id == "" # 新規プロジェクト構成データの場合は # プロジェクト選択プルダウンを出力 collectio...
Ruby
module Extensions::AirHelper end
Ruby
module AirHelper end
Ruby
module ProjectlogHelper include ApplicationHelper include ProjectHelper include ERB::Util def disp_projectlog_information(log) task_key = case log.dat_projectcomp.task_kbn when 1 then :task#app_localized_message(:label, :task) when 2 then :milestone#app_localized_message(:lab...
Ruby
require_dependency 'jsmin' require 'action_view/helpers/asset_tag_helper' module JsminHelper #** #* javascriptファイルの圧縮とファイル結合スクリプトへパラメータを渡す #* def jscomp(paths=null) if !@jscomp_src @jscomp_src = Array.new end @jscomp_src.push(paths) end def csscomp(paths, prefix='') if !@csscom...
Ruby
# #= マイルストーンモデル # # # class DatMilestone < ActiveRecord::Base ######################### # 関連定義 ######################### # プロジェクト構成データに所有される(1:1) belongs_to :dat_projectcomp, :foreign_key => "project_tree_id" ######################### # 検証機能定義 # (全てのインスタンスで共通の検査項目は、クラスメソッドで定義) # (:messageの指定は、言語DBのエ...
Ruby
# #= プロジェクトユーザモデル # # # class DatProjectuser < ActiveRecord::Base ######################### # 関連定義 ######################### # プロジェクトデータに所有される(1:多) belongs_to :dat_project, :foreign_key => "project_id" # ユーザーマスタに所有される(1:多) belongs_to :mst_user, :foreign_key=>"user_id" # タスクユーザーデータを所有する(1:多) has_m...
Ruby
# #= タスクコメントモデル # # # class DatTaskcmt < ActiveRecord::Base ######################### # 関連定義 ######################### # タスクデータに所有される(1:多) belongs_to :dat_task end
Ruby
# #= プロジェクトアイテムクラス # # # class ClsProjectitem attr_reader :isclass attr_reader :projectcomp attr_reader :class_level # #=== コンストラクタ # # def initialize( isclass, level, projectcomp ) @isclass = isclass @projectcomp = projectcomp @class_level = level end # #=== 分類名を返す # # def n...
Ruby
# #= プロジェクトモデル #WBS,ガントチャート,カレンダーなどプロジェクト構成オブジェクトの一覧を取得する #また,テンプレートデータ(テンプレートマスタ)から属性値をコピーする # class DatProject < ActiveRecord::Base ######################### # 関連定義 ######################### # プロジェクト構成データを所有する(1:多) has_many :dat_projectcomps, :foreign_key => "project_id", :dependent=>:destroy # プロジェクトユーザ...
Ruby
# #= テンプレートマイルストーンマスタモデル # # # class MstTpmilestone < ActiveRecord::Base ######################### # 関連定義 ######################### # テンプレート構成マスタに所有される(1:1) belongs_to :mst_composition, :foreign_key => "template_tree_id" end
Ruby
require 'digest/sha1' # #= ユーザマスタモデル # #ログイン時の認証、パスワードの暗号化・変更を行う。 # class MstUser < ActiveRecord::Base attr_accessor :password_confirmation # #=== ユーザーオブジェクトを返す # #ログインID、パスワードを元にユーザーデータを検索し #一致した場合(認証OK)はユーザーオブジェクトを返す。 # def self.authenticate(login, pass) logger.info login + ':' + pass + ' > ' ...
Ruby
# #= プロジェクトコンポーネントモデル # #プロジェクト構成オブジェクト(タスク・マイルストーン・イベント)の追加・更新・削除後に #ログを出力する。 # #プロジェクト構成オブジェクトの種類はtask_kbnで識別する。 # task_kbn = 1 => タスク # task_kbn = 2 => マイルストーン # task_kbn = 3 => イベント # class DatProjectcomp < ActiveRecord::Base ######################### # 関連定義 ######################### # プロジェクトデータに所有される(1:多...
Ruby
# #= テンプレートマスタモデル # # # class MstTemplate < ActiveRecord::Base ######################### # 関連定義 ######################### # テンプレート構成マスタを所有する(1:多) has_many :mst_compositions, :foreign_key => "template_id", :dependent=>:destroy end
Ruby
class DatCall < ActiveRecord::Base end
Ruby
# #= アプリケーションメーラー # #サインアップ完了通知・招待・プロジェクト召集のメールを送信する。 # class AppMailer < Iso2022jpMailer helper ApplicationHelper # #=== サインアップ完了メールを送信する # # def mail_signup_confirm( user, info ) recipients user.email subject NKF.nkf('-j', info[:subject]) from ActionMailer::Base.smtp_settings[:app_default_f...
Ruby
# -*- coding: utf-8 -*- # #= タスク履歴モデル # # # class DatTaskhistory < ActiveRecord::Base ######################### # 関連定義 ######################### # タスクデータに所有される(1:多) belongs_to :dat_task belongs_to :update_user, :class_name => 'MstUser', :foreign_key => 'update_user_id' end
Ruby
# #= テンプレートタスクマスタモデル # # # class MstTptask < ActiveRecord::Base ######################### # 関連定義 ######################### # テンプレート構成マスタに所有される(1:1) belongs_to :mst_composition, :foreign_key => "template_tree_id" end
Ruby
# #= タスクモデル # # # class DatTask < ActiveRecord::Base ######################### # 関連定義 ######################### # プロジェクト構成データに所有される(1:1) belongs_to :dat_projectcomp, :foreign_key => "project_tree_id" # タスクコメントデータを所有する(1:多) has_many :dat_taskcmts, :foreign_key => "task_id", :dependent=>:destroy # タスクユーザ...
Ruby