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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-1.2.0.min.css"> | |
</head> | |
<body> | |
<div class="row"> | |
<div class="span12" align="center"> | |
Head | |
</div> |
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
<h1>New Grabs</h1> | |
<%= form_for(@climbing) do |f| %> | |
<table> | |
<tr> | |
<td><%= User.all %></td> | |
</tr> | |
<tr> | |
<td> | |
<%= f.select "action", [["部活", "circle"], ["闇練", "training"], ["予定", "plan"]] %> |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
helper_method :current_user | |
private | |
def current_user | |
@current_user ||= User.find(session[:user_id]) if session[:user_id] | |
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
class ClimbingsController < ApplicationController | |
def create | |
@climbing = Climbing.new(params[:climbing]) | |
@climbing.user = current_user | |
if @climbing.save | |
redirect_to @climbing | |
else |
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
class User < ActiveRecord::Base | |
def self.create_with_omniauth(auth) | |
create! do |user| | |
user.provider = auth["provider"] | |
user.uid = auth["uid"] | |
user.name = auth["info"]["name"] | |
user.secret = auth["credentials"]["secret"] | |
end | |
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
var Person = function(name) { | |
this.name = name; | |
}; | |
Person.prototype.say = function () { | |
return "I am " + this.name; | |
}; | |
var adam = new Person("Adam"); | |
document.writeln(adam.say()); |
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
var Objectmaker = function () { | |
this.name = "This is it"; | |
var that = {}; | |
that.name = "And that's that"; | |
return that; | |
}; | |
var o = new Objectmaker(); | |
document.writeln(o.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
function Waffle() { | |
return { | |
tastes: "yummy" | |
}; | |
}; | |
var first = new Waffle(); | |
var second = Waffle(); | |
document.writeln(first.tastes); | |
document.writeln(second.tastes); |
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
class ClimbingsController < ApplicationController | |
def index | |
@climbings = Climbing.with_user | |
end | |
def new | |
@climbing = Climbing.new | |
respond_to do |format| | |
format.html # new.html.erb |
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
function writeCode(callback) { | |
console.log("writeCode"); | |
callback(); | |
} | |
function introduceBugs() { | |
console.log("introduceBugs"); | |
return function () { | |
console.log("callback") | |
} | |
} |