This file contains hidden or 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
Blog.where(created_at: 1.week.ago.beginning_of_week..1.week.ago.end_of_week).order(view_counts: :desc).first.subject |
This file contains hidden or 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
<script> | |
var canvas = document.getElementById("clockCanvas"); | |
var ctx = canvas.getContext ? canvas.getContext("2d") : null; | |
var intervalId = setInterval(function () { | |
drawClock(new Date()); | |
}, 1000); | |
</script> | |
<a href="#" onclick="clearInterval(intervalId);">Stop</a> |
This file contains hidden or 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 Rack | |
class MemoryBloat | |
def initialize(app, logger) | |
@app = app | |
@logger = logger | |
end | |
def call(env) | |
memory_usage_before = memory_usage | |
result = @app.call(env) |
This file contains hidden or 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
# orig http://open.taobao.com/demo/RubyDemo.rb | |
#此DEMO的功能:查询手机类的淘客商品 | |
require 'digest/md5' | |
require 'open-uri' | |
require 'cgi' | |
#组装参数 | |
param_array = { | |
#组装协议参数 |
This file contains hidden or 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
replaceLinkText : function(text) { | |
text = this._unescapeHTML.unescape(text.replace(/&/g,"&")); | |
var elem = document.createElement("description"); | |
elem.className = "twitter-notifier-message-body"; | |
var pat = /((http(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/([\w#!:.?+=&%@~*\';,\-\/\$])*)?/g; | |
var re = /[.,;:]$/; | |
while (pat.exec(text) != null) { |
This file contains hidden or 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
#schema.rb | |
ActiveRecord::Schema.define(:version => 2) do | |
create_table "stories", :force => true do |t| | |
t.string "title", "subtitle" | |
t.string "type" | |
t.integer "length_counter", :default => 0 | |
t.boolean "published" | |
end | |
NewerOlder