code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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 DefaultMapping
include Hobo::DefineTags
mapping_tags do
panel.advert >> panel.green
end
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module TaskKindsHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module TaskStatusesHelper
end
| Ruby |
module TasksHelper
end
| Ruby |
module ProjectsHelper
end
| Ruby |
module AssignmentsHelper
end
| Ruby |
module FrontHelper
end
| Ruby |
class TaskKind < ActiveRecord::Base
hobo_model
has_many :tasks
# --- Hobo Permissions --- #
def creatable_by?(creator)
false
end
def updatable_by?(updater, new)
false
end
def deletable_by?(deleter)
false
end
def viewable_by?(viewer, field)
true
end
end
| Ruby |
class Assignment < ActiveRecord::Base
hobo_model
belongs_to :user
belongs_to :task
# --- Hobo Permissions --- #
def creatable_by?(creator)
false
end
def updatable_by?(updater, new)
false
end
def deletable_by?(deleter)
false
end
def viewable_by?(viewer, field)
true
end
e... | Ruby |
class Guest
def display_name
"Guest"
end
def guest?
true
end
def super_user?
false
end
def can_update?(obj, field)
false
end
def can_delete?(obj)
false
end
def can_create?(obj)
false
end
def can_view?(obj, field)
true
end
end
| Ruby |
class User < ActiveRecord::Base
hobo_model
include Hobo::AuthenticatedUser
has_many :assignments
has_many :tasks, :through => :assignments
set_login_attr :username
alias_attribute :display_name, :username
# --- Hobo Permissions --- #
def super_user?
login == 'admin' || administrator?
... | Ruby |
class Project < ActiveRecord::Base
hobo_model
belongs_to :user
belongs_to :owner, :class_name => User, :foreign_key => "owner_id"
# --- Hobo Permissions --- #
def creatable_by?(creator)
false
end
def updatable_by?(updater, new)
false
end
def deletable_by?(deleter)
false
end
de... | Ruby |
class Task < ActiveRecord::Base
hobo_model
has_many :assignments
has_many :users, :through => :assignments
belongs_to :projects
belongs_to :task_kind
belongs_to :task_status
# --- Hobo Permissions --- #
def creatable_by?(creator)
false
end
def updatable_by?(updater, new)
false
end
... | Ruby |
class TaskStatus < ActiveRecord::Base
hobo_model
has_many :tasks
# --- Hobo Permissions --- #
def creatable_by?(creator)
false
end
def updatable_by?(updater, new)
false
end
def deletable_by?(deleter)
false
end
def viewable_by?(viewer, field)
true
end
end
| Ruby |
class TaskStatusesController < ApplicationController
hobo_model_controller
end
| Ruby |
class ProjectsController < ApplicationController
hobo_model_controller
end
| Ruby |
class FrontController < ApplicationController
hobo_controller
filter_parameter_logging "password"
def index; end
def search
if request.post?
site_search(params[:query])
end
end
def login
return unless request.post?
user = Hobo.user_model.authenticate(params[:login], params[:pass... | Ruby |
class TasksController < ApplicationController
hobo_model_controller
end
| Ruby |
class AssignmentsController < ApplicationController
hobo_model_controller
end
| Ruby |
class UsersController < ApplicationController
hobo_model_controller
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
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_communicat... | Ruby |
class TaskKindsController < ApplicationController
hobo_model_controller
end
| Ruby |
ActionController::Routing::Routes.draw do |map|
map.search 'search', :controller => 'front', :action => 'search'
map.homepage '', :controller => 'front', :action => 'index'
map.login 'login', :controller => 'front', :action => 'login'
map.logout 'logout', :controller => 'front', :action => 'logout'
map... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
... | Ruby |
# Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION ... | 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
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | 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 |
# $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 |
# Compass configurations
sass_path = File.dirname(__FILE__)
css_path = File.join(sass_path, "..", "css")
# Require any additional compass plugins here.
images_dir = File.join(sass_path, "..", "img")
output_style = :expanded
environment = :production | 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 |
# -*- Ruby -*-
require 'fileutils'
def find_version
File.read("yasnippet.el") =~ /;; Package-version: *([0-9.]+[a-z]?) *$/
$version = $1
end
find_version
FileUtils.mkdir_p('pkg')
desc "generate bundle file for classic snippets."
task :bundle do
sh 'emacs --batch -l yasnippet.el --eval "(yas/compile-bundle)"'
... | Ruby |
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# textmate_import.rb --- import textmate snippets
#
# Copyright (C) 2009 Rob Christie, 2010 João Távora
#
# This is a quick script to generate YASnippets from TextMate Snippets.
#
# I based the script off of a python script of a similar nature by
# Jeff Wheeler: http://nokr... | Ruby |
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# textmate_import.rb --- import textmate snippets
#
# Copyright (C) 2009 Rob Christie, 2010 João Távora
#
# This is a quick script to generate YASnippets from TextMate Snippets.
#
# I based the script off of a python script of a similar nature by
# Jeff Wheeler: http://nokr... | Ruby |
# -*- Ruby -*-
require 'fileutils'
def find_version
File.read("yasnippet.el") =~ /;; Package-version: *([0-9.]+[a-z]?) *$/
$version = $1
end
find_version
FileUtils.mkdir_p('pkg')
desc "generate bundle file for classic snippets."
task :bundle do
sh 'emacs --batch -l yasnippet.el --eval "(yas/compile-bundle)"'
... | Ruby |
#coding:UTF-8
require 'rubygems'
require 'watir-webdriver'
browser = Watir::Browser.start 'http://www.12306.cn/mormhweb/kyfw/', :ie
Watir::Wait::until { browser.iframe(:name, 'iframepage').exist?}
sleep(10)
iframepage = browser.iframe(:name, 'iframepage')
iframe = iframepage.iframe(:name, 'main')
fro... | Ruby |
#coding:utf-8
require 'win32ole'
load 'pic_to_str.rb'
HTTPS_HOST='https://dynamic.12306.cn'
client = HTTPClient.new(:agent_name =>'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)')
#证书路径
client.ssl_config.add_trust_ca "srcr.cer"
#验证码图片地址
image_code = 'https://dynamic.12306.cn/otsweb/passCodeAction.d... | Ruby |
#coding:utf-8
require 'rubygems'
require 'httpclient'
require 'nokogiri'
class PictureToStr
def send_picture(site, form)
code_client = HTTPClient.new
res = code_client.post site, form
raise res.status if res.status != 200
res
end
def find_str(html, css_selector)
code_str = Nokogiri::HTML... | Ruby |
class CreateWebConfigs < ActiveRecord::Migration
def self.up
create_table :web_configs do |t|
t.string :name
t.string :description
t.integer :style
t.text :content
end
end
def self.down
drop_table :web_configs
end
end
| Ruby |
class AddShortDesToArticles < ActiveRecord::Migration
def self.up
add_column(:articles,:short_des,:string)
end
def self.down
remove_column(:articles,:short_des)
end
end
| Ruby |
class CreateArticles < ActiveRecord::Migration
def self.up
create_table :articles do |t|
t.string :title
t.text :content
t.timestamps
end
end
def self.down
drop_table :articles
end
end
| Ruby |
class CreateNavigations < ActiveRecord::Migration
def self.up
create_table :navigations do |t|
t.string :name
t.string :display_name
t.string :link_address
t.integer :ord
t.integer :level
t.integer :parent_id
end
end
def self.down
drop_table :navigations
end... | 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/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/console'
| 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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
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/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/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 NewsHelper
end
| Ruby |
module WebConfigsHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def page_title
@title ? @title+"--北京掌上明珠信息技术有限公司":"北京掌上明珠信息技术有限公司"
end
end
| Ruby |
module NavigationsHelper
end
| Ruby |
module ArticlesHelper
end
| Ruby |
module DisplayHelper
end
| Ruby |
class WebConfig < ActiveRecord::Base
end
| Ruby |
class Navigation < ActiveRecord::Base
end
| Ruby |
class Article < ActiveRecord::Base
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.