Skip to content

Instantly share code, notes, and snippets.

View nakaearth's full-sized avatar

Nakamura shinichirou nakaearth

View GitHub Profile
@nakaearth
nakaearth / app_decorators_user_decorator_1.rb
Last active August 29, 2015 14:02
MovieDecoratorの例1
class UserDecorator < Draper::Decorator
delegate_all
def short_name
object.name[0, 5]
end
end
@nakaearth
nakaearth / application.js
Created December 17, 2013 02:03
rails g angular:installを実行した直後のapplication.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
@nakaearth
nakaearth / index.html
Last active December 30, 2015 21:18
ブログサンプル
<!DOCTYPE html>
<html lang="ja" ng-app="EventSample">
<head>
<script src="assets/application.js"></script>
<link href="assets/application.css" media="all" rel="stylesheet" />
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
@nakaearth
nakaearth / app.js.coffee
Created December 10, 2013 05:33
ブログサンプル
window.App = angular.module('EventSample', ['ngResource'])
@nakaearth
nakaearth / application.js
Last active December 30, 2015 21:18
ブログネタサンプル
//= require angular
//= require angular-resource
//= require app
//= require_tree ./angular
@nakaearth
nakaearth / events_ctrl.js.coffee
Last active December 30, 2015 21:18
ブログ用のサンプルコード
App.controller 'EventsCtrl', ['$scope', 'Events', ($scope, Events) ->
$scope.events = Events.query()
]
@nakaearth
nakaearth / events.js.coffee
Last active December 30, 2015 21:09
ブログのサンプルコード
App.factory 'Events', ['$resource', ($resource) ->
$resource '/events/index'
]
@nakaearth
nakaearth / seeds.rb
Last active December 30, 2015 21:09
ブログネタ初期データ投入
#coding: utf-8
Event.create(title: '忘年会', description: '会社の忘年会をします')
Event.create(title: 'クリスマス会', description: '家族でクリスマス会をします。')
Event.create(title: '子供と出かける日', description: '子供を連れて、買い物に行きます')
@nakaearth
nakaearth / events_controller.rb
Last active December 30, 2015 21:09
ブログのサンプル
class EventsController < ApplicationController
def index
@events = Event.all
render json: @events
end
end
@nakaearth
nakaearth / index.html
Last active December 30, 2015 18:38
ブログ用のサンプルコード
<!DOCTYPE HTML>
<html ng-app>
<head>
<script src="assets/application.js"></script>
<script src="js/testScript.js"></script>
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">