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
<%= link_to "Sign up",{:controller=>"users",:action=>"new"} ,:class=>"some-class-name" %> |
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
<script type="text/javascript"> | |
//Javascript trim() example | |
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); }; | |
//Usage: | |
var str = " foo bar "; | |
alert("Original string: '" + str + "'"); | |
str = str.trim(); | |
alert("Trimmed string: '" + str + "'"); | |
</script> |
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
#Ruby on Rails: How to bypass Model validation | |
#User Model | |
class User < ActiveRecord::Base | |
validates_presence_of :first_name, :last_name | |
end | |
#BusinessAccount Model | |
class BusinessAccount < ActiveRecord::Base | |
validates_uniqueness_of :username | |
validates_presence_of :username, :category, :name |
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
# Search all history | |
randika@randika-XPS-M1330:~$ history | |
1 sudo apt-get install aptitude | |
2 sudo aptitude update | |
3 sudo aptitude install build-essential curl git-core | |
........ | |
........ | |
29 chmod 400 xxxxx.pem | |
30 ssh -i xxxxx.pem [email protected] |
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
$ lsof -i -P | grep 3000 | |
ruby 11374 randika 5u IPv4 26389 0t0 TCP *:3000 (LISTEN) | |
# Terminate the process if you want | |
$ kill -9 11374 |
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
$ sudo apt-get install aptitude | |
Make sure to update once finished. | |
$ sudo aptitude update | |
OK now we have aptitude installed on our system and let’s install rvm. There is a shell script already on rvm server for this. To run this script we need git and curl installed on our system. | |
$ sudo aptitude install build-essential curl git-core |
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
activesupport (3.1.1) lib/active_support/whiny_nil.rb:48:in `method_missing' | |
storage_room (0.3.13) lib/storage_room/embeddeds/file.rb:24:in `set_with_filename' | |
storage_room (0.3.13) lib/storage_room/embeddeds/file.rb:15:in `block in new_with_filename' | |
storage_room (0.3.13) lib/storage_room/embeddeds/file.rb:15:in `tap' | |
storage_room (0.3.13) lib/storage_room/embeddeds/file.rb:15:in `new_with_filename' | |
app/controllers/entry_controller.rb:11:in `create' | |
actionpack (3.1.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action' | |
actionpack (3.1.1) lib/abstract_controller/base.rb:167:in `process_action' | |
actionpack (3.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action' | |
actionpack (3.1.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action' |
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
# Create database, user and grant permissions | |
grant all on <DATABASE>.* to '<USER>'@'%' identified by '<PASSWORD>'; |
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
###How to deploy rails 3.1 app on heroku Cedar stack | |
Gem configuration | |
============================== | |
1) On your Gem file move the default sqlite3 gem config to development group and add PosgreSQL | |
group :production do | |
# gems specifically for Heroku go here | |
gem "pg" | |
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
Apache Server Permission set-up | |
================================ | |
sudo chown -R www-data:www-data /home/ubuntu/websites | |
sudo chmod -R 755 /home/ubuntu/websites |
OlderNewer