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
#!/usr/bin/ruby -w | |
require 'rexml/document' | |
include REXML | |
xmlfile = File.new("tour_treepath_area.xml") | |
xmldoc = Document.new(xmlfile) | |
root = xmldoc.root | |
#puts root.attributes["ver"] |
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
#!/usr/bin/ruby | |
# coding: utf-8 | |
require 'uri' | |
#require 'iconv' | |
require 'open-uri' | |
require 'thread' | |
def scrape(from,to,n) | |
begin |
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
#!/usr/bin/ruby | |
# coding: utf-8 | |
require 'uri' | |
require 'iconv' | |
require 'open-uri' | |
if $0 == __FILE__ | |
url = 'http://jingdian.tuniu.com/fengjing/' | |
num = 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
class ApplicationController < ActionController::Base | |
before_filter :cors_set_access_control_header | |
# other staff | |
private | |
def cors_set_access_control_header | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS' | |
headers['Access-Control-Request-Method'] = '*' |
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
sudo find ./ -name ".DS_Store" -depth -exec rm -f {} \; |
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
#!/usr/bin/ruby -w | |
def presskey(keycode) | |
system "osascript -e 'tell application \"System Events\" to key code #{keycode}'" | |
end | |
kVK_LeftArrow = 123 | |
kVK_RightArrow = 124 | |
kVK_DownArrow = 125 | |
kVK_UpArrow = 126 |
NewerOlder