Skip to content

Instantly share code, notes, and snippets.

View nakaearth's full-sized avatar

Nakamura shinichirou nakaearth

View GitHub Profile
var testCtrl = function($scope) {
$scope.users = [
{"name": "nakamura", "point": "10"},
{"name": "hoge", "point": "20"},
{"name": "ugaugo", "point": "200"},
];
}
one:
id: 1
title: 'MyString'
stamp_aws_id: 1
usertokenid: 'testaaaa1111'
downloadcount: 10
category: 'words'
rank_display_flag: 0
stamp_file_name: 'test.jpg'
stamp_content_type: 'jpg'
private
def update_params
params.require(:hoge).permit(:title, :description, :priority, :status)
end
@nakaearth
nakaearth / access.yml
Last active December 15, 2015 03:09
アクセス制限を書ける時に使うymlファイルの例
localhost: &localnet
/admin/user:
- 192.168.111.22
development:
<<: *localnet
test:
<<: *localnet
production:
/admin/point:
- 56.2.107.111
class Stamp < ActiveRecord::Base
Paperclip.interpolates :img_dir_num do |attachment, style|
(attachment.instance.id * 0.01).to_i
end
Paperclip.interpolates :filename do |attachment, style|
attachment.instance.id.to_s + ".png"
end
if Rails.env.production?
S3_CREDENTIALS = {access_key_id: ENV['S3_ACCESS_KEY_ID'], secret_access_key: ENV['S3_SECRET_KEY'], bucket: "hoge-bucket"}
end
@nakaearth
nakaearth / Stamp.rb
Last active December 14, 2015 13:58
Stamp.rbのPaperclipのサンプル抜粋
class Stamp < ActiveRecord::Base
####途中省略####
if Rails.env.production?
S3_CREDENTIALS={access_key_id:ENV['S3_ACCESS_KEY_ID'], secret_access_key:ENV['S3_SECRET_KEY'], bucket:"hoge-bucket"}
end
if Rails.env.production?
has_attached_file :stamp, storage: :s3, s3_credentials: S3_CREDENTIALS,
styles: {stamps_s:"100x100&gt;",stamps:"350x350&gt;"},url:":s3_domain_url",path:"stamps/:style/:filename"
else
has_attached_file :stamp, url: "/:style/:img_dir_num/:filename" , styles: {stamps_s:"100x100&gt;",stamps:"350x350&gt;"}