- 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,
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 |
require 'socket' | |
Socket.tcp_server_loop(4481) do |connection| # 处理连接。 | |
# 必要的处理 | |
connection.close | |
end |
# 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 %} | |
# |
/* | |
_ooOoo_ | |
o8888888o | |
88" . "88 | |
(| -_- |) | |
O\ = /O | |
____/`---'\____ | |
.' \\| |// `. | |
/ \\||| : |||// \ | |
/ _||||| -:- |||||- \ |
# Using fonts in Rails | |
config.assets.paths << Rails.root.join('app', 'assets', 'fonts') | |
config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/ |
[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 |
require 'socket' | |
include Socket::Constants | |
client = TCPSocket.open 'example.com', 1234 | |
begin | |
retry_counter = 0 | |
client.write( "GET / HTTP/1.0\r\n\r\n" ) | |
results = client.read |
hash[:new_key] = hash.delete :old_key |
# Copied from https://gist.github.com/rainchen, original author: https://github.com/rainchen | |
# | |
# set in application.rb | |
# config.middleware.insert_after 'Rack::MethodOverride', 'BlockBadSpider' | |
class BlockBadSpider | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |