`
clark1231
  • 浏览: 253490 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论
文章列表
上一篇:给Octopress博客添加标签云 http://clark1231.iteye.com/blog/1565853 中通过Category_list.rb不断的重写categories_tag.html和categories_sidebar.html这两个文件   查了下在Octopress的第三方插件中发现有相应的“标签云”和“类别”显示 https://github.com/tokkonopapa/octopress-tagcloud   此外我重新整理了一篇“用Octopress来写博客” 地址:http://caok.github.com/blog/2012/06 ...
发现在octopress似乎没有现成可以放在sidebar的分类,于是自己动手弄一个,首先你可以增加个category_list.rb防止在Octoprss的plugins文件夹下 # encoding: utf-8 module Jekyll class Site def create_category_list write_to_tag_cloud if @config['category_tag_cloud'] write_to_sidebar if @config['category_sidebar'] end ...
/etc/resolv.conf中设置dns之后每次重启该文件会被覆盖,针对这种情况找了一些个解决方法 防止/etc/resolv.conf被覆盖的方法   方法一 1.需要创建一个文件/etc/resolvconf/resolv.conf.d/tail sudo vi /etc/resolvconf/resolv.conf.d/tail 2.在该文件中写入自己需要的dns服务器,格式与/etc/resolv.conf相同   nameserver 8.8.8.8 3.重启下resolvconf程序 sudo /etc/init.d/resolvconf restart   ...

ubuntu网络配置

1.设置静态ip地址 sudo vi /etc/network/interfaces ###interfaces中####### auto eth0 iface eth0 inet static address 192.168.3.250 netmask 255.255.255.0 #子网掩码 gateway 192.168.3.1 #网关 配置动态ip auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp  2.设置DNS sudo ...
1 首先对源列表做好备份: sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup 2 根据系统不同选择合适的编辑编辑器打开原列表: sudo vii /etc/apt/sources.list 3.用找到的更新源替换原先的。 4.收尾工作: sudo apt-get update 如果发现无法正常更新,请使用备份还原: sudo cp /etc/apt/sources.list_backup /etc/apt/sources.list
  很多时候,在安装gem的过程中会出现找不到资源的error,我们需要从另外一个gem服务器下载安装。 通过gem sources命令配置源,或通过修改Gemfile中的source语句可以实现。 常用的源http://rubygems.org/ http://gems.github.com http://gems.rubyforge.org http://ruby.taobao.org 国内应该找个比较靠谱了,适合安装大多数常见的gem 显示当前使用的sourcesgem sources添加一个sourcegem sources -a url地址删除一个source ...
def current_user @current_user ||= session[:user_id] && User.find(session[:user_id]) end 短短一行代码,却含有很多逻辑,以前老是搞混,这里总结一下。 这句代码相当于  def current_user if @current_user return @current_user else if session[:user_id] @current_user = User.find(session[:user_id]) else ...
The Nil Expression It’s pretty important that you understand the difference of these expressions. To begin, let’s start with nil. Nil is the ruby way of saying NULL. Whenever there is an expression that returns nothing, we get a nil that specifies that. For instance, in a find_by, if the record is n ...
一、配置文件说明(_config.yml): 1.Main Configs   url: http://yoursite.com # blog 地址 title: Your name # blog 名称,出现在左上角 subtitle: # title下面的副标题 author: #每篇文章的posted by simple_search: http://google.com/search #右边搜索框使用 ...

linux格式化U盘

图形: 1.装一个gparted,找那个/dev/sdb, 2.右击选择格式化,最后点“应用”。   命令行: 原则是先卸载,后格式化。假如u盘挂载在/media/disk上卸载:sudo umount /media/disk     查看: sudo fdisk -l 查看u盘是不是/dev/sdb。 格式化:sudo mkfs.vfat /dev/sdb不同的格式对应不同的格式化命令:mkfs mkfs.cramfs mkfs.ext3 mkfs.ext4dev mkfs.msdos mkfs.vfat mkfs.bfs mkfs.ext2 mkfs.ext4 ...
rails 1.new and server With just three commands we whipped up a Rails server listening on port 3000 rails new commandsapp cd commandsapp rails server(rails s) rails server -e production -p 4000 rails server –help 2.generate
推荐Lucifr和JerryQu的几篇博文: Sublime Text 2 入门及技巧 via: http://lucifr.com/139225/sublime-text-2-tricks-and-tips/ Sublime Text 2 实用快捷键 via: http://lucifr.com/139235/sublime-text-2-useful-shortcuts/ Sublime Text2:超赞的现代编辑器 via: http://www.imququ.com/post/i_love_sublime-text-2.html 一些必不可少的Sublime Text ...
1.查询 (1)查询存在的数据库   show databases;   选择所要的某个数据库  use databasename; (2)查询当前数据库存在的所有的表   show tables; (3)查询表结构   describe tablename; (4)查询表格列的属性   show columns from tableName; (5)查询记录   select name from tablename where id=xxx; (6)查询当前时间
Test Case Description:   Created vanilla rails 3.0.7 app with single controller containing 5 actions.   Each action was guarded by a 'before_filter ..., :only => '.   Each action and each filter 'puts '   The five filters did: always returned true always returned false always rendered ...
针对有些情况下下拉菜单过长导致选择不便,此处我将演示通过输入文字自动补全来选择   我这里要在product的view中自动补全thing   Gemfile中   gem 'rails3-jquery-autocomplete'   routes中   resources :products do collection do get :autocomplete_thing_name end end   thing.rb中(这里想显示name、material、size三个字段)   def name_with_material_and_s ...
Global site tag (gtag.js) - Google Analytics