- ruby 1.9.2
- rails 3.2.1
| .DS_Store | |
| ._* | |
| node_modules/ |
| #!/bin/bash | |
| set -e # exit on error | |
| ### README | |
| # * installs your desired ruby versions using rbenv | |
| # ** including openssl (needed by bundler) | |
| # ** including sqlite (probably needed for rails apps) | |
| # | |
| # Before you start: | |
| # * put ssh-keys in place |
| var unref = require('./build/Release/unref.node').unref; | |
| var http = require('http'); | |
| http.createServer(function(req,res){ | |
| res.writeHead(200, {'Content-Type': 'text/plain'}); | |
| res.end('Loop Counter='+unref()+'\n'); | |
| }).listen(8080); |
| cd ~ | |
| sudo yum update | |
| sudo yum install java-1.7.0-openjdk.i686 -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /usr/local/share |
原文:Scaling Isomorphic Javascript Code (This is just for study, please contact me at tily05 atmark gmail.com if any problem.)
考えてみれば Model-View-Controller とか MVC ってよく聞くよね。実際どんなものか知ってる? 抽象的に言うなら「オブジェクト情報の保持されるグラフィック・システム (つまり、ラスターではないグラフィック。ゲームとか) 上に構築された、表示系を中心としたアプリケーションにおいて、主要な機能どうしの関わりをうまく分離すること」とでも言おうか。もう少し深く考えを押し進めてみれば、これは当然、他のさまざまなアプリケーションにもあてはまる言葉 (bucket term ?) だ。
過去に多くの開発コミュニティが MVC による解決案を提供し、それによってよくあるユースケースにうまく対処し、地位を築くことができた。例をあげるなら、Ruby や Python コミュニティは Rails や Django を作り、MVC アーキテクチャを実現した。
| %w!ubygems scissor/echonest pit open-uri tempfile!.each {|g| require g } | |
| Scissor.logger.level = Logger::DEBUG | |
| Scissor.echonest_api_key = Pit.get('echonest.com', :require => { | |
| 'api_key' => 'your Echo Nest API key' | |
| })['api_key'] | |
| infile, outfile = ARGV | |
| file = Tempfile.new(%w/amen .wav/) |
By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.
| # ## Backbone model caching | |
| # This is a simple solution to the problem "how do I make less requests to | |
| # my server?". | |
| # | |
| # Whenever you need a model instance, this will check first if the same thing | |
| # has been fetched before, and gives you the same instance instead of fetching | |
| # the same data from the server again. | |
| # | |
| # Reusing the same instance also has the great side-effect of making your | |
| # model changeable from one part of your code, with your changes being available |
These commands are good as of 2011-07-27.
App store http://itunes.apple.com/us/app/xcode/id448457090?mt=12) The download/install takes awhile so start it first. When it finishes downloading you will still need to run it to complete installation.