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 | |
# * First, you would to got PoolDeletingDomainsList.txt from [here](http://www.pool.com/Downloads/PoolDeletingDomainsList.zip) | |
# * Unzip this zip file, get PoolDeletingDomainsList.txt file, put the txt file in this file on one folder | |
# * In shell or cmd, run `ruby domains.rb`, you will get you would like domains list in DomainsList.txt file | |
# * There are 6 length domain, so change the length if you would. | |
class Domains | |
def self.would_domains(input_file = "PoolDeletingDomainsList.txt", output_file = "DomainsList.txt") |
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
something.to_json.gsub(/\\u([0-9a-z]{4})/){|s| [$1.to_i(16)].pack("U")} |
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
include Rack::Utils | |
alias_method :h, :escape_html | |
def split_content(string) | |
show_html = "" | |
p_content = [] | |
lines = string.split("\n") | |
lines.each_with_index do |line, index| | |
new_line = h(line.strip) | |
if index != lines.length - 1 |
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 'date' | |
require 'time' | |
time = Time.parse("Wed, 9 May 2012 16:00:00 +0800") | |
# the src is like | |
#time = Time.parse("2012.05.09 16:00 +08:00") | |
puts time # 2012-05-09 16:00:00 +0800 |
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 'rss' | |
require 'open-uri' | |
# url or local file | |
source = "http://snippets.aktagon.com/main.rss" | |
# and ths src when if url is https | |
require 'openssl' |
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 'rubygems' | |
require 'rufus/scheduler' | |
scheduler = Rufus::Scheduler.start_new | |
puts "start work at #{Time.new.strftime('%Y-%m-%d %H:%M:%S')}" | |
scheduler.every '1m' do |
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 'rubygems' | |
require 'mechanize' | |
# Create a new mechanize object | |
agent = Mechanize.new | |
# set verify mode becaust the website used https | |
agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE |
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
if (typeof (AC) === "undefined") { | |
AC = {} | |
} | |
AC.ImageReplacer = Class.create({ | |
_defaultOptions: { | |
listenToSwapView: true, | |
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i, | |
filenameInsert: "_☃x", | |
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i, | |
attribute: "data-hires", |
NewerOlder