This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this file to spec/support/ | |
module RSpec | |
module Core | |
class ExampleGroup | |
def self.Then(*args, &block) | |
args[0] = "Then #{args[0]}" if args[0].is_a?(String) | |
it(*args, &block) | |
end | |
def self.Given(*args, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def within_date?(date, from_date, to_date) | |
date = date.to_date | |
(Time.parse("#{date.year}/#{from_date}").to_date..Time.parse("#{date.year}/#{to_date}").to_date).include?(date) | |
end | |
date = Time.parse("1982-3-30") | |
puts within_date?(date, "3/1", "3/30").inspect | |
puts within_date?(date, "2/1", "2/28").inspect | |
if within_date?(date, "3/1", "3/30") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem: --no-ri --no-rdoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/application.rb | |
module MyApp | |
class Application < Rails::Application | |
... | |
Time::DATE_FORMATS.merge!(:default => "%Y-%m-%d %H:%M", :ymd => "%Y-%m-%d", :md => "%m/%d", :week_day => "%u") | |
... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Background Stretcher jQuery Plugin | |
© 2011 ajaxBlender.com | |
For any questions please visit www.ajaxblender.com | |
or email us at support@ajaxblender.com | |
Version: 2.0.1 | |
*/ | |
;(function($){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'active_support/core_ext/object' | |
require "net/https" | |
require "uri" | |
require "kippt" | |
require "hashie" | |
# install kippt api client gems: | |
# | |
# gem install kippt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActsAsIsEnabled | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def acts_as_is_enabled | |
scope :enabled, where(:is_enabled => true) | |
scope :disabled, where(:is_enabled => [false,nil]) # 如果 db 有設定 default => false 的話, 不用 nil 了, 看起來也會乾淨一點 | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
@queue = "update_status" | |
def self.perform(user_id,status) | |
User.find(user_id).update_attributes(:status=>status) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
div { | |
position:relative; | |
top:-100px; | |
} | |
img { | |
position: absolute; | |
clip:rect(100px 100px 200px 0px); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
phpinfo(); | |
?> |