This file contains hidden or 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
curl -v -H "Content-Type: application/json" -X POST -d '{"title":"Hello World"}' http://localhost:3000/notes |
This file contains hidden or 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
Octal Text Binary Description | |
============================================================= | |
0 --- 000 All types of access are denied | |
1 --x 001 Execute access is allowed only | |
2 -w- 010 Write access is allowed only | |
3 -wx 011 Write and execute access are allowed | |
4 r-- 100 Read access is allowed only | |
5 r-x 101 Read and execute access are allowed | |
6 rw- 110 Read and write access are allowed | |
7 rwx 111 Everything is allowed |
This file contains hidden or 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
# The current configuration for CarrierWave | |
CarrierWave.configure do |config| | |
config.storage = :s3 | |
config.s3_access_policy = :public_read | |
config.s3_access_key_id = S3_CONFIG['access_key_id'] | |
config.s3_secret_access_key = S3_CONFIG['secret_access_key'] | |
config.s3_bucket = S3_CONFIG['bucket'] | |
end |
This file contains hidden or 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 example was summarized from http://www.playframework.org/documentation/1.2/validation and | |
// reproduced here for quick reference. | |
// To achieve model-level validations (versus handling at controller level), first annotate | |
// the properties of the model. | |
package models; | |
public class User { | |
This file contains hidden or 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
require 'rbconfig' | |
host_os = RbConfig::CONFIG['host_os'] | |
if host_os ~= /mac|darwin/i | |
# Mac | |
elsif host_os ~= /bsd/i | |
# BSD | |
elsif host_os ~= /solaris|sunos/i | |
# Solaris | |
elsif host_os ~= /linux/i |
This file contains hidden or 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Your Website</title> | |
</head> | |
<body> |
This file contains hidden or 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
# Add the Will Paginate plugin to the gemfile | |
gem 'will_paginate', '3.0.pre2' | |
# Place this code in the controller | |
@items = Item.all.paginate(:page => params[:page] || 1, :per_page => 10) | |
# Place this code in the view | |
<%= will_paginate @items %> |
NewerOlder