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-color: white; | |
background-image: url(bg.png); | |
background-image: url(bg.png), -webkit-gradient(linear, left top, right bottom, from(#000000), to(#ffffff)); | |
background-image: url(bg.png), -moz-linear-gradient(-45deg, #000000, #ffffff); | |
background-attachment: fixed; |
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
unless Rails.env.production? | |
ActiveMerchant::Billing::Base.mode = :test | |
end | |
config = YAML.load(ERB.new(File.read("#{Rails.root}/config/paypal.yml")).result)[Rails.env] | |
PaypalGateway = ActiveMerchant::Billing::PaypalAdaptivePayment.new( | |
:login => config["username"], | |
:password => config["password"], | |
:signature => config["signature"], | |
:appid => config["application_id"] | |
) |
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 PaypalController < ApplicationController | |
def approval | |
raise "not loggined" unless login_user | |
@approval = Approval.find_or_create_by :user_id => login_user.id, :item_id => params[:item_id] | |
raise "subscribed!" if @approval.key | |
start_date = Time.now.gmtime | |
end_date = 3.months.from_now.gmttime |
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 Approval | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
belongs_to :user | |
field :item_id | |
field :key | |
field :approved, :type=> Boolean, :default => false | |
def pay |
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
Rails.application.routes.url_helpers |
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 StateMachine | |
class Event | |
def transition opt={from:nil,to:nil,guard:nil} | |
self.ts ||= {} | |
self.ts[ opt[:from] ] = opt if (opt[:from].is_a? String) || (opt[:from].is_a? Symbol) | |
opt[:from].each do |name| | |
ts[name] = opt | |
end if opt[:from].is_a? Array | |
end | |
attr_accessor :ts |
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
/** | |
jquery.glance.js ver1.0 | |
The MIT License | |
Copyright (c) since 2012 Grow! inc. jun takeno | |
http://about.me/yamitake | |
http://twitter.com/yamitake | |
Permission is hereby granted, free of charge, to any person obtaining a copy |
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
# ruby1.9 で正規化して、エンコードするまで | |
"なんかきもいやつら". | |
tr("\u{301C 2016 2212 00A2 00A3 00AC 2014 00A6}","\u{FF5E 2225 FF0D FFE0 FFE1 FFE2 2015 FFE4}").encode("sjis") |
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
.entypo-phone:before { content: "\1F4DE"; } | |
.entypo-mobile:before { content: "\1F4F1"; } | |
.entypo-mouse:before { content: "\E789"; } | |
.entypo-address:before { content: "\E723"; } | |
.entypo-mail:before { content: "\2709"; } | |
.entypo-paper-plane:before { content: "\1F53F"; } | |
.entypo-pencil:before { content: "\270E"; } | |
.entypo-feather:before { content: "\2712"; } | |
.entypo-attach:before { content: "\1F4CE"; } | |
.entypo-inbox:before { content: "\E777"; } |
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 MarkdownHelper | |
_markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, | |
:autolink => true, :space_after_headers => true) | |
define_method :markdown do |text| | |
raw _markdown.render(text) | |
end | |
end |