you need to install plugins blow:
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
## 准备工作 | |
[从全新数据库开始](http://msdn.microsoft.com/en-us/data/jj193542) | |
[从已有的数据库开始](http://msdn.microsoft.com/en-us/data/jj200620) | |
*值得注意的是需要安装Nuget和Power Tools两个插件,并且保证你的EF是5.0* | |
## 模型 | |
对于需要返回多个模型到同一个视图的情况,可以采用如下的方式: |
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
# this guide is based on http://ruby-china.org/wiki/install_ruby_guide and linuxmint | |
# -------what'new----- | |
# fixed some bug | |
# add solution for common errors | |
# 2013-10-17 | |
# install sqlite3 | |
sudo apt-get install libsqlite3-dev | |
# 2013-8-15 |
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
## config sources | |
sudo vim /etc/apt/sources.list | |
#网易源(速度很快) | |
deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse | |
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse | |
deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted | |
deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted | |
deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted | |
deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted |
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 ruby | |
#encoding:utf-8 | |
require 'csv' | |
require 'open-uri' | |
require 'nokogiri' | |
require 'date' | |
def generate_url(date) | |
"http://history.tianqizx.cn/his_1582_" + date.strftime('%Y/%-m/%-d') + ".aspx" |
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
//在controller和directive中定时修改作用域模型的方式 | |
app.controller('generalCtrl', ['$scope', function($scope) { | |
$scope.pv = 0; | |
//通过调用apply触发内部的direct循环,从而更新作用域和模型 | |
setInterval(function(){$scope.$apply()}, 1000); | |
}]) | |
directives.directive('rtIp', function(){ | |
return function(scope, elm, attrs) { | |
setInterval(function(){scope.pv = scope.pv + 1;}, 1000); |
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
export PATH=$HOME/local/bin:$PATH | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
#for git | |
BASH_NEWLINE="\n" | |
BASH_GRAY="\[\e[1;30m\]" | |
BASH_LIGHT_GREEN="\[\e[1;32m\]" | |
BASH_WHITE="\[\e[1;0m\]" |
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 ruby | |
##encoding:utf-8 | |
require 'open-uri' | |
require 'nokogiri' | |
require 'stringio' | |
def generate_cast_url(link) | |
link + "?view=asciicast" | |
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/env ruby | |
##encoding:utf-8 | |
require 'open-uri' | |
require 'nokogiri' | |
require 'stringio' | |
require 'watir-webdriver' | |
def generate_cast_url(link) | |
link + "?view=asciicast" |
In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.
A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval
.
You can find instance_eval
used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.
class Article < ActiveRecord::Base
OlderNewer