07 2013 档案
摘要:api中木有找到。 request.env对象获取客户端用户和本地的一些信息,如下:SERVER_NAMEPATH_INFOREMOTE_HOSTHTTP_ACCEPT_ENCODINGHTTP_USER_AGENTSERVER_PROTOCOLHTTP_CACHE_CONTROLHTTP_ACCEPT_LANGUAGEHTTP_HOSTREMOTE_ADDRSERVER_SOFTWAREHTTP_KEEP_ALIVEHTTP_REFERERHTTP_COOKIEHTTP_ACCEPT_CHARSETREQUEST_URISERVER_PORTGATEWAY_INTERFACEQ...
阅读全文
摘要:先看一段代码:var awardMedals, contenders, gold, rest, silver, __slice = [].slice;gold = silver = rest = "unknown";awardMedals = function() { var first, others, second; first = arguments[0], second = arguments[1], others = 3 <= arguments.length ? __slice.call(arguments, 2) : []; gold = first;
阅读全文
摘要:我目前只学会了两种最简单的。 1.flash. The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create action that setsflash[:notice] = "Post...
阅读全文
摘要:sudo add-apt-repository ppa:webupd8team/sublime-text-2sudo apt-get updatesudo apt-get install sublime-text sudo sublime-text
阅读全文
摘要:参考:http://railsapps.github.io/rails-environment-variables.html 整理一下,方法主要有三种: 一.直接设置UNIX环境变量,这个不用讲了吧。 二.使用Figaro Gem1.$ rails generate figaro:install2.在config/application.yml中添加想要添加的环境变量3.在某些环境变量不被允许的场景下可以用: Figaro.env.gmail_username4.设置不同开发场景中:HELLO: worlddevelopment: HELLO: develope...
阅读全文
摘要:在layout/application.html.erb中加入如下: zuo you 在/assets/javascript 中的bootstrap**.js或者自己新建一个.js文件,添加相应的js代码:$(document).ready(function(){ $('.carousel').carousel({interval:7000});}); 不是太难吧,不过我花了一段时间主要是才入手,路径什么的很多问题不清楚,另外就是rails用的coffee js等一些问题,不过总算搞定啦...
阅读全文
摘要:paperclip是rails的一个上传文件的包,简单学习了一下。 https://github.com/thoughtbot/paperclip,官方教程。 ImageMagick,教程中指出必须安装,我用的是Ubuntu 12.04LTS,提示已经安装好了。 使用方法: 在相应model中添加:class User { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"e
阅读全文
摘要:Rails 4废除了之前的attr_accessible机制,为了安全起见,使用了新的strong parameter。写代码遇到点小问题,简单了解一下。官方教程 http://edgeguides.rubyonrails.org/action_controller_overview.html#strong-parameters class PeopleController < ActionController::Base # This will raise an ActiveModel::ForbiddenAttributes exception # because it's.
阅读全文
摘要:1.安装Scrapyhttp://doc.scrapy.org/en/latest/topics/ubuntu.html#topics-ubuntu根据上面链接,选择自己的ubuntu版本的安装包curl -s http://archive.scrapy.org/ubuntu/archive.key | sudo apt-key add -利用这个命令添加相应的keysudo apt-get install scrapy2.创建第一个demo参照教程http://doc.scrapy.org/en/latest/intro/tutorial.html#intro-tutorial这里有一点小问
阅读全文
摘要:cat /dev/null > ~/.local/share/recently_used.xbelrm ~/.local/share/zeitgeist/activity.sqlite还有一个ubuntu 12.04带的管理工具:Activity-log-manager。
阅读全文

浙公网安备 33010602011771号