Alvin Ye 上海捷道 Agideo
open2ye · 共 48 篇文章
用 tsocks 完美解决 bundle 慢的问题
sudo apt-get install tsocks gstm vi /etc/tsocks.conf local = 127.0.0.1/255.255.255.255 # Set the IP of your SSH server server = 127.0.0.1 server_type = 5 server_port = 1234 sudo ssh -qTfnN -D 127.0.0.1:1234 alvin@15vpn.com tsocks bundle install tsocks curl whatismyip.org
2011-10-12 16:02 · 评论(0)
安装 Ruby Enterprise Edition 出罕见错误
make[1]: Entering directory `/tmp/ruby-enterprise-1.8.7-2011.03/source/ ext/gdbm' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/tmp/ruby-enterprise-1.8.7-2011.03/source/ ext/gdbm' compiling iconv make[1]: Entering directory `/tmp/ruby-enterprise-1.8.7-2011.03/source/ ext/iconv…
2011-05-30 10:09 · 评论(0)
自制小工具 一键贴图
鼠标右单击即可上传图片 地址要短 要直接到剪贴板 require 'rubygems' require "win32/clipboard" include Win32 $filename = ARGV[0] TYPES = %w{.jpg .gif .png .jpeg} def upload_file(file) puts "Your want to upload file #{$filename}" cmd = "curl -s -F Filedata=@\"#{$filename}\" -F Filename=\"#{File.basename(file)}\" -F Upload=\…
2010-07-07 21:23 · Ruby · 评论(3)
Rails 在搜索表单中用 OpenStruct
in controller require 'ostruct' def index @search = OpenStruct.new(params) end in view <% form_for :search, :url => {:action => "index"}, :html => {:method => :get} do |f| %> <%= f.text_field :quick %> <%= f.submit "Search" %> <% end %> 简单, 喜欢
2010-02-01 22:02 · 评论(6)
vim 去掉自动注释和自动回车
经常 putty 到 服务器的 vim 粘贴一段小代码进去如 # aaa # bb class Book # zzz end 结果成了这样 # aaa # # bb # class Book # # zzz # end # # 原因是开启了自动注释和自动缩进 :set paste 再 Shift + Insert 正常了 恢复 :set paste!
2009-08-13 09:59 · 评论(0)
rails snippet on vim
rails snippet on vim install snipMate http://www.vim.org/scripts/script.php?script_id=2540 install rails.snippet http://github.com/scrooloose/snipmate-snippets/tree/master 感谢,几位辛苦的作者. 我已经尝试更新最版版本, 安装脚本如下 # install snipMate cd /tmp wget http://www.vim.org/scripts/download_script.php?src_id=10801 -O …
2009-06-13 13:36 · Rails · 评论(8)
让 chrome 支持 google bookmarks
1 任意将一个连接拖到 chrome 的 toolbar 上 2 右单击 修改, 将网址改为 javascript:void(function(){var d=document,e=encodeURIComponent,s1=window.getSelection,s2=d.getSelection,s3=d.selection,s=s1?s1():s2?s2():s3?s3.createRange().text:'',r='http://www.google.com/bookmarks/mark?op=add&title=&bkmk='+e(d.location.href)+'&title…
2009-04-24 13:24 · snippet · 评论(1)
vim 插件推荐 dbext.vim
地址: http://www.vim.org/scripts/script.php?script_id=356 安装后 运行 :DBSetOption user=tiger:passwd=scott:dbname=xxx_db :Select id,login from users 在vim 的新窗口中就会出现 +-----+--------------+ | id | login | +-----+--------------+ | 1 | admin | +-----+--------------+ 另外常用的还有 :DBHistory :DBListTable 另外可以自己方便扩展
2008-12-29 13:07 · 评论(1)
用Ruby 来调用 mssql(sqlserver) 的 ntext 等 unicode 类型
访问数量库时用 DBI.connect(ODBC_NAME,ODBC_USER, ODBC_PWD) do |db| db.do('set textsize 9999') # 如果没有这句会抛错 db.select_all("select * from end unicode -> utf8 or gb2312 require 'iconv' require 'cgi' class Iconv def Iconv.unicode2utf8(unicode_string) unicode_string.gsub(/\\u\w{4}/) do |s| str = s.sub(/\\u/, "")…
2008-12-22 11:52 · 评论(0)
chrome 文件上传问题会出现 content_type 为空的问题
前两天 我们的 Rails 项目 中错误日志中显示, 附件有问题。 反复测试发是 Chrome 搞得鬼, 如果你上传 zip chrome 居然让你的附件的 content_type 为空 ?? 毕竟是beta版
2008-12-14 23:10 · 评论(1)
Google App Engine Hello World
1 先注册 http://code.google.com/appengine/ 注意输入手机号码时格式为 +86137xxxxxxxx 一个Google 帐号只能发几次, 如果你的号码发送不了, 试着重新注册一个Google 帐号, 我就是这样解决的 另外有些人说只能支持联通, 我的是移动,可以支持 2 安装 python2.5 :http://www.python.org/ftp/python/2.5/python-2.5.msi 3 安装 Google App Engine SDK : http://code.google.com/appengine/downloads.html 4 将…
2008-11-20 00:21 · 评论(1)
007大破量子危机 有点失望
今天跟老婆一起去看了这部电影 觉得不值电影票钱 除了“普京邦德”的动作一样刺激外 剧情, 惊险, 性感的邦女郎, 都没有
2008-11-11 23:19 · 评论(10)
忽然发现Google拼音输入法还有个好处 中文分词
中文分词 对搜索引擎来说是个大麻烦, Google有了拼音输入法后, 就能及时收集到又新双全的中文词库, 李彦宏 也应搞个输入法才行
2008-10-31 22:17 · 评论(7)