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/env python | |
# -*- coding: utf-8 -*- | |
#sync contacts of SINA WeiBo to Google contacts,then U can sync all contacts to your Mobile using *Google Sync* client. | |
#see: http://code.google.com/apis/contacts/docs/3.0/developers_guide_python.html && http://www.google.com/mobile/sync/ | |
#by [email protected] | yuwei@staff | |
import atom | |
import gdata.contacts | |
import gdata.contacts.service | |
import csv |
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
require 'rubygems' | |
require 'xmpp4r' | |
require 'xmpp4r/roster/helper/roster' | |
#Jabber::debug = true | |
jid = Jabber::JID.new('[email protected]')#my weibo uid | |
cl = Jabber::Client.new(jid) |
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
%w(rubygems sinatra oauth weibo).each { |lib| require lib } | |
enable :sessions | |
Weibo::Config.api_key = "3926176445" | |
Weibo::Config.api_secret = "651156f9b786fdc0781376f3b121f359" | |
get '/' do | |
"<a href='/connect'>授权,搜索公交站点信息</a>" | |
end |
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 | |
#author [email protected] | |
%w(rubygems mechanize iconv).each{|lib| require lib} | |
def auto_search(name,password,keyword) | |
m = Mechanize.new | |
m.get('http://cas.erp.sina.com.cn/cas/login?ext=&service=http://searchemp.erp.sina.com.cn/login02.asp') do |page| | |
my_page = page.form_with(:name => 'login_form') do |f| | |
f.username = name |
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
require 'rubygems' | |
require 'eventmachine' | |
EM.run{ | |
channel = EM::Channel.new | |
sid = channel.subscribe{ |topic,msg| p [topic, msg] } | |
channel.push(['topic',{'key1'=>'value1'}]) | |
channel.push({'topic'=>'test','msg'=>{'a'=>'b'}}) | |
channel.unsubscribe(sid) | |
EM.stop | |
} |
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
require 'rubygems' | |
require "em-udns" | |
EM.run do | |
EM::Udns.nameservers = "8.8.8.8" | |
resolver = EM::Udns::Resolver.new | |
EM::Udns.run resolver | |
query = resolver.submit_A "gmail.com" |
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
document.addEventListener("deviceready", function(){ | |
var initUrl = location.href; | |
if (Device.platform === 'Android') { | |
//阻止按后退按钮就退出程序 | |
navigator.app.overrideBackbutton(true); | |
} | |
/*解决jquerymobile用phonegap打包后后退导航失效问题*/ | |
document.addEventListener("backbutton", function(){ |
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
var jsdom = require('jsdom'), console = require('console'); | |
jsdom.env({ | |
html: 'https://github.com/popular/forked', | |
scripts: [ | |
'http://code.jquery.com/jquery-1.5.min.js' | |
], | |
done: function(errors, window) { | |
var $ = window.$; | |
console.log($('td.title > a').length); |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'net/http' | |
require 'openssl' | |
require 'open-uri' | |
class Net::HTTP | |
alias_method :origConnect, :connect | |
def connect |
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
for (var i = 0; i < 1024 * 1024; i++) { | |
process.nextTick(function () { Math.sqrt(i) } ) | |
} |