- 博客(628)
- 资源 (7)
- 问答 (1)
- 收藏
- 关注
原创 git如何合并 多个commit
需要先搞明白rebase然后,进这个界面[code="java"]pick b76d157 bpick a931ac7 c# Rebase df23917..a931ac7 onto df23917## Commands:# p, pick = use commit# r, reword = use commit, but edit the comm...
2013-07-02 20:42:06 458
原创 rvm create gemset
[code="ruby"]rvm ruby-1.9.3-p429 do rvm gemset create union[/code]
2013-07-01 09:00:28 305
关于devise结合github通过omniauth登录
最近写了个github帐户登录Demo:[url]https://github.com/yankforce/devise_omniauth_github[/url]演示项目地址:[url]http://devise-github.herokuapp.com[/url]BASIC版本,只是github omniauth,可以参考这个[url]https://g...
2013-06-24 04:47:31 232
原创 在ubuntu中.profile 和.bashrc的加载区别
总之,profile不只是bash,在启动加载bashrc是bash在,起bash session加载[code="java"].bashrc is for Bash only, while .profile is used by other shells as well.Another important difference is that .profile is us...
2013-06-01 21:38:19 218
原创 ubuntu 13.04 ruby 安装依赖
[code="java"]sudo aptitude install build-essential bison openssl libreadline5 libreadline5-dev curl git-core zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libmysqlclie...
2013-06-01 20:59:47 154
原创 console for sinatra
[url]git://github.com/sickill/racksh.git[/url]也是用来做同样的事。只是可以模拟http请求[code="ruby"]# make GET request$rack.get uri, params, env# make POST request$rack.post uri, params, env# m...
2013-05-24 21:19:51 113
原创 git revert merge commit
[code="ruby"]0ce2ca0b35f59af267241cf4d40d16a3e13ba6f3df1acf5f54426d30f12c6b4558c3dd922297aae3e19b912404ffd3c153ccac3072dbf22396896d2a#要revert的commit是mergegit revert -m 2 0ce2ca0b35f59af267...
2013-05-07 08:10:14 176
原创 cdata 和 xml xmlParseEntityRef: no name 错误
Problem:An XML parser returns the error “xmlParseEntityRef: no name”Cause:There is a stray ‘&’ (ampersand character) somewhere in the XML text eg. some text & some more textSolution:Solu...
2013-05-04 00:24:31 405
原创 一目了然 rails html xml encode decode
[code="ruby"]1.9.2p320 :001 > require 'htmlentities'1.9.2p320 :002 > c = HTMLEntities.new #=> #1.9.2p320 :003 > c.decode ">" #=> ">"1.9.2p320 :004 > require 'cgi'# => false1.9.2p3
2013-05-03 23:37:38 116
原创 使用scope 链接多个where条件
[code="ruby"] scope :by_category, (lambda do |category_id| where(category_id: category_id) unless category_id.nil? end) scope :by_district, (lambda do |district_id| where(district...
2013-05-02 09:17:32 288
原创 在rspec里使用 route path
[code="ruby"]Rspec.configure do |config| config.include Rails.application.routes.url_helpers ...end[/code]
2013-05-01 20:09:39 102
原创 postgresql install and configure for ubuntu
ABSTRACTPostgreSQL is an object-relational database system that has the features of traditional commercial database systems with enhancements to be found in next-generation DBMS systems. This blog...
2013-04-25 08:13:01 129
原创 Destroying a Postgres DB on Heroku
[code="java"]heroku pg:reset DATABASE[/code]
2013-04-24 10:58:15 93
原创 关于Jquery的plugin使用
[code="js"]// jQuery, the fn property is just an alias to the prototype property.//The jQuery identifier (or $) is just a constructor function, and all instances created with it, inherit from ...
2013-04-14 10:30:32 191
原创 select_tag default value & options
[code="ruby"]#If you are using select_tag without any other helper, then you can do it in html:select_tag "whatever", "VISAMasterCard"#Or with options_for_select:select_tag "whatever", o...
2013-04-10 21:40:04 132
原创 Jquery array remove
[code="js"]Array.prototype.remove = function(el){ return this.splice(this.indexOf(el),1);}var arr = [1,2,3,4,5];arr.remove(4);console.log(arr);//[1,2,3,5]var array = [1,2,3,4,5];...
2013-04-10 21:38:48 182
原创 jquery read table
[code="js"]$('#mytable tr').each(function() { var customerId = $(this).find("td").eq(2).html(); });var items=[], options=[];//Iterate all td's in second column$('#tableId>tbody...
2013-04-10 20:54:03 70
原创 ruby readline的两种写法
[code="ruby"]f = File.read('public/file.csv').readlines = f.each_line.map{|x|x}lines = File.readlines('public/file.csv')[/code]
2013-04-09 10:21:45 750
原创 关于encoding utf-8
一 gem解决方案[url]https://github.com/m-ryan/magic_encoding[/url]二,rake task 解决方案[code="ruby"]desc "Manage the encoding header of Ruby files"task :check_encoding_headers => :environment do f...
2013-04-04 20:55:52 459
原创 我见过最清楚的解释class_eval 和 instance_eval
忘了,看一次就能回忆起来[code="ruby"]class A # defs here go to A puts self # => A class
2013-04-02 07:06:59 151
原创 multiple provider oauth
Allowing users to login with multiple authentication providers brings great benefits but also results in some annoying edge cases. For example, what happens when they login with one provider, logout a...
2013-04-01 11:13:50 92
原创 oauth github和multiple oauth
[url=http://railscasts.com/episodes/241-simple-omniauth]http://railscasts.com/episodes/241-simple-omniauth [/url][url=http://github.com/intridea/omniauth]OmniAuth[/url] is a recently released li...
2013-04-01 11:08:11 95
原创 关于view image
https://github.com/mwaterfall/MWPhotoBrowserhttps://github.com/facebook/three20
2013-03-27 12:05:50 106
原创 使用push在两个tableview或者tableviewcell切换
push segue between the view controllers总之,要把第一个view加NavigationController方便的可以这样[code="java"]Editor > Embed In > Navigation Controller[/code]也可以:[quote]NavigationController -> UIView...
2013-03-27 10:41:58 116
原创 Ruby Jquery 地图,地理信息相关资源
[url=http://railscasts.com/episodes/273-geocoder?view=asciicast]Railscast Geocorder[/url][img]http://asciicasts.com/system/photos/702/original/E273I05.png[/img][url=http://www.rubygeocoder.com...
2013-03-22 20:32:41 76
原创 load migrate file and load
[code="java"]Dir[Rails.root.join('db','migrate','*.rb')].each{|file|require file}Dir[File.dirname(__FILE__) + '/../lib/*.rb'].each do |file| require File.basename(file, File.extname(file))...
2013-03-22 05:52:46 80
原创 Brew update problem
[quote]MBA:~ fortin$ brew updateerror: Your local changes to the following files would be overwritten by merge: expect.rb libiconv.rb ncurses.rb openldap.rb openssh.rb ...
2013-03-22 05:48:03 99
原创 UItableview cell 背景
[code="c"][/code]Here is the most efficient way I have come across to solve this problem, use the willDisplayCell delegate method (this takes care of the white color for the text label backg...
2013-03-20 11:01:53 59
原创 iOS UItableviewcell 点按钮修改cell颜色
[code="c"]@interface MyTableViewController : UITableViewController { UIColor *cellColor;}-(IBAction)click:(id)sender;@implementation MyTableViewController -(IBAction)click:(id)...
2013-03-20 10:58:54 132
原创 change the author of a commit in git?
删除项目里的大文件[code="java"]git filter-branch --index-filter \ 'find -name ''*.mp3'' -or -name ''*.ogg'' | xargs -d''\n'' rm -f'#Suppose you want to remove a file (containing confidential ...
2013-03-19 20:34:05 83
原创 Jquery sort table number
So here is what the column is sorted as: 4,666 141,666 293 341,666 346 461,676This should be sorted as 293 346 4,666 141,666 341,666 ...
2013-03-19 01:01:50 88
原创 update_all
[code="ruby"]Article.limit(2).update_all ["updated_at = :time", time: Time.now], ["created_at > :time", time: Time.now - 12.days]Article.limit(2).update_all ["updated_at = ?", Time.now]list ...
2013-03-13 02:09:20 136
原创 接着上面的母子表单
Creating a new Rails project$ mkdir family# create rvm gemset$ echo "rvm use --create ruby-1.9.2@family"> family/.rvmrc$ cd family# install rails$ gem install rails# cre...
2013-03-12 11:45:06 157
原创 有关嵌套资源的使用,母子表单
[code="ruby"]class Post < ActiveRecord::Base validates_presence_of :name, :title validates_length_of :title, :minimum => 5 has_many :comments has_many :tags accepts_nested_attribu...
2013-03-12 11:43:11 331
原创 set vim as git commit default editor
[code="java"]git config --global core.editor "vim"[/code][code="java"]echo "export EDITOR='vim'" >> ~/.profileexport EDITOR='vim'export VISUAL=vim[/code][code="ruby"]# ~/.bashr
2013-03-11 20:43:47 261
原创 objective c Basic
Passing Data ForwardPassing data forward to a view controller from another view controller. You would use this method if you wanted to pass an object/value from one view controller to another vi...
2013-03-09 10:02:33 112
原创 jquery each and find
[code="js"]$(document).ready(function () { var selectedTable = $('table').eq('9'); $(selectedTable).css('border','10px solid green'); $(selectedTable).find('tr td').each(function(...
2013-03-06 04:14:26 82
原创 find and filter out permission denied
[code="java"]find . 2>/dev/null > files_and_foldersfind . 2>&1 | grep -v 'permission denied' > files_and_foldersfind . 2>/dev/null > some_filefind . 2>&1 | grep -v 'Permission denied' > so...
2013-03-06 04:04:14 74
原创 javascript at IE of trim problem
[code="js"]var ID = document.getElementByID('rep_id').value.trim();[/code][quote]Message: Object doesn't support this property or methodLine: 604Char: 2Code: 0URI: http://test.localh...
2013-03-06 04:02:27 72
agile web development with rails 4th edition 源代码
2011-04-25
The Rails3 Way, 2nd Edition
2011-04-25
The RSpec Book
2010-10-14
linux 驱动开发中文版 2.6内核
2009-03-29
可以问个新手问题吗-Rails为什么不显示验证信息
2009-02-16
TA创建的收藏夹 TA关注的收藏夹
TA关注的人