Permalink
Browse files

add magic_encoding

  • Loading branch information...
lg2046 committed Feb 16, 2012
1 parent 4aa1777 commit efed61f87f804aa44da1b04adaac18bbf4f22142
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? Rails
require File.dirname(__FILE__) + '/lib/ajax_redirect_helper'
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module AjaxRedirectHelper
def ajax_redirect_to(path)
render :js => "$.utils.redirect_to('#{path}')"
View
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? Rails
require File.dirname(__FILE__) + '/lib/active_record_base'
require File.dirname(__FILE__) + '/lib/active_record_errors'
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class ActiveRecord::Base
class << self
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? ActiveRecord
class ActiveModel::Errors
View
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? ActiveSupport
Dir.glob(File.expand_path(File.dirname(__FILE__) + '/lib/*.rb')) do |file|
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class Array
def rand
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
def should_be_have(obj)
obj.present?
end
@@ -12,4 +13,4 @@ def should_greater_than_zero(obj)
def should_greater_than_or_equal_zero(obj)
should_be_have(obj) && should_be_number(obj) && (obj.to_s.to_f >= 0)
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class Date
def last_week
self - 7
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class Fixnum
def roundf(places)
temp = self.to_s.length
@@ -44,4 +45,4 @@ def to_see_zero?
self < 0.00001 ? true : false
end
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class Hash
# hash取值 的时候先取符号号的,再取字符串 设置值的时候设成符号key
@@ -10,4 +11,4 @@ def method_missing(method, *params)
end
end
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class NilClass
def each
@@ -11,4 +12,4 @@ def dup
def to_hash
{}
end
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class Numeric
def to_clock
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
HOLIDAY_DATE = {
2009 => [
[1,1],[1,2],
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class String
def is_a_number?
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class Time
#used for Timezone insensitive comparisons
def === t
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? Rails
require File.dirname(__FILE__) + '/lib/cool_authentication'
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class ActionController::Base
helper_method :current_user, :logged_in?
View
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? OAuth
require File.dirname(__FILE__) + "/lib/oauth_patch"
end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module OAuth::Client
class Helper
def oauth_parameters
@@ -1 +1,2 @@
-require File.dirname(__FILE__) + '/lib/extended_validations' if defined? Paperclip
+# -*- encoding : utf-8 -*-
+require File.dirname(__FILE__) + '/lib/extended_validations' if defined? Paperclip
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module Paperclip
module ExtendedValidations
def self.included(base)
@@ -68,4 +69,4 @@ def validates_attachment_extension(attachment, options = {})
# Inject Paperclip::ExtendedValidations into ActiveRecord::Base
if defined?(ActiveRecord::Base)
ActiveRecord::Base.send(:include, Paperclip::ExtendedValidations)
-end
+end
View
@@ -1 +1,2 @@
-require File.dirname(__FILE__) + '/lib/resque_async' if defined? Resque
+# -*- encoding : utf-8 -*-
+require File.dirname(__FILE__) + '/lib/resque_async' if defined? Resque
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
# 可以让类的类方法使用delay的形式
# TestTask.delay(:google, "sina")
# 或者是
@@ -21,4 +22,4 @@ def self.delay_at(at_time, method, *args)
Resque.enqueue_at(at_time, self, method, *args)
end
end
-end
+end
View
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? Rails
require 'yaml'
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module Tencentpay
module Config
class << self
@@ -13,4 +14,4 @@ def load_config
end
end
-Tencentpay::Config.load_config
+Tencentpay::Config.load_config
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module Tencentpay
class Query
# GATEWAY_URL = "http://mch.tenpay.com/cgi-bin/cfbi_query_order_v3.cgi"
@@ -35,4 +36,4 @@ class Query
# @response ||= QueryResponse.new(Net::HTTP.get(URI.parse("#{GATEWAY_URL}?#{params}")))
# end
end
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module Tencentpay
class QueryResponse #
# def initialize(response)
@@ -62,4 +63,4 @@ class QueryResponse #
# "transaction_id=#{transaction_id}&key=#{Tenpay::Config.key}"
# end
end
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module Tencentpay
class Request
GATEWAY_URL = "http://service.tenpay.com/cgi-bin/v3.0/payservice.cgi"
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
module Tencentpay
class Response
attr_reader :sp_billno, :total_fee, :attach
View
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
if defined? Rails
require File.dirname(__FILE__) + '/lib/file_size_validator'
-end
+end
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
class FileSizeValidator < ActiveModel::EachValidator
MESSAGES = { :is => :wrong_size, :minimum => :size_too_small, :maximum => :size_too_big }.freeze
CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze
View
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
require File.dirname(__FILE__) + '/lib/white_list_helper'
if defined? ActionView
@@ -1,3 +1,4 @@
+# -*- encoding : utf-8 -*-
require "set"
module WhiteListHelper
extend self
@@ -78,4 +79,4 @@ def contains_bad_protocols?(value)
WhiteListHelper.bad_tags = %w(script)
WhiteListHelper.tags = %w(h1 h2 h3 h4 h5 h6 table tr th td thead tbody tfoot a blockquote br caption cite code dl dt dd em i img li ol p pre q small strike strong b sub sup u ul span font div embed)
WhiteListHelper.attributes = %w(target name src type loop autostart quality allowscriptaccess alt title color size face class cellspacing cellpadding href title cite src alt width height align valign colspan rowspan bgcolor style border)
-WhiteListHelper.protocols = %w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto feed)
+WhiteListHelper.protocols = %w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto feed)

0 comments on commit efed61f

Please sign in to comment.