- Sync plans List all active plans
[8] pry(main)> RSpreedly::SubscriptionPlan.active
=> [#<RSpreedly::SubscriptionPlan:0x000001051e4be0
@description="<description>",
@duration_quantity=12,
@duration_units="months",
@id=25113,| #!/usr/bin/ruby | |
| require 'socket' | |
| class PortServer | |
| attr_reader(:port,:server) | |
| def initialize(port) | |
| @port = port | |
| end |
[8] pry(main)> RSpreedly::SubscriptionPlan.active
=> [#<RSpreedly::SubscriptionPlan:0x000001051e4be0
@description="<description>",
@duration_quantity=12,
@duration_units="months",
@id=25113,| # Using fonts in Rails | |
| config.assets.paths << Rails.root.join('app', 'assets', 'fonts') | |
| config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/ |
| /* | |
| _ooOoo_ | |
| o8888888o | |
| 88" . "88 | |
| (| -_- |) | |
| O\ = /O | |
| ____/`---'\____ | |
| .' \\| |// `. | |
| / \\||| : |||// \ | |
| / _||||| -:- |||||- \ |
| # Title: PDF previewer for Octopress | |
| # Author: Martin (http://martin91.github.io/) | |
| # Description: Convert a pdf file into a series of images, and then output a html | |
| # <ul> block with each <li></li> correspond to each image orderly. | |
| # | |
| # Syntax {% pdf_tag relative/path/to/pdf/file/under/source/directory %} | |
| # | |
| # Example: | |
| # {% pdf_tag WebRTC introduction %} | |
| # |
| require 'socket' | |
| Socket.tcp_server_loop(4481) do |connection| # 处理连接。 | |
| # 必要的处理 | |
| connection.close | |
| end |
| function auto_set_tab_chrome_background_color { | |
| # Red component value is calculated from the full path of current directory | |
| RR=`pwd | wc -m` | |
| let RR=(RR%25)*10 | |
| # Green component value is calculated from the basename of current directory | |
| GG=`basename \`pwd\` | wc -m` | |
| let GG=(GG%25)*10*2 | |
| # Blue component value is calculated from the full total files and directories count under this directory |
| # state_machine: https://github.com/pluginaweek/state_machine | |
| class Order < ActiveRecord::Base | |
| state_machine :state, initial: :cart do | |
| before_transition on: :checkout, do: :reduce_buyer_balance | |
| after_transition on: :dispatch_goods, do: :create_shipping_log | |
| after_transition on: :confirm, do: :charge_to_seller | |
| event :checkout do | |
| transition :cart => :paid |
| # Attention: the below methods are actions extracted from my controllers in a Rails App, if you need to use these codes outside | |
| # a Rails project, rememeber to replace some Rails-specified methods, such as, Hash#to_param. | |
| # STEP 1: start to request an authorization | |
| def request_authorize | |
| session[:security_state] = 'I am from Martin site' | |
| authorize_url = "https://api.weibo.com/oauth2/authorize" | |
| params = { | |
| client_id: "663911642", # Required: Your assigned App Key |
| module Conditions | |
| def self.included(base) | |
| class << base | |
| attr_reader :conditions_map | |
| def condition(name, &block) | |
| @conditions_map ||= Hash.new | |
| @conditions_map.store(name, block) | |
| end |