Skip to content

Instantly share code, notes, and snippets.

View vestige's full-sized avatar

Makoto Yonezawa vestige

View GitHub Profile
@vestige
vestige / mock.html
Created November 14, 2011 14:00
mock
<!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>
@vestige
vestige / gist:2343620
Created April 9, 2012 13:59
new.html.erb
<h1>New Grabs</h1>
<%= form_for(@climbing) do |f| %>
<table>
<tr>
<td><%= User.all %></td>
</tr>
<tr>
<td>
<%= f.select "action", [["部活", "circle"], ["闇練", "training"], ["予定", "plan"]] %>
@vestige
vestige / gist:2343693
Created April 9, 2012 14:08
application_controller
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
class ClimbingsController < ApplicationController
def create
@climbing = Climbing.new(params[:climbing])
@climbing.user = current_user
if @climbing.save
redirect_to @climbing
else
@vestige
vestige / gist:2471006
Created April 23, 2012 13:44
user.rb
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
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());
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);
@vestige
vestige / gist:2479746
Created April 24, 2012 13:39
waffle.js
function Waffle() {
return {
tastes: "yummy"
};
};
var first = new Waffle();
var second = Waffle();
document.writeln(first.tastes);
document.writeln(second.tastes);
@vestige
vestige / gist:2558682
Created April 30, 2012 14:15
controller
class ClimbingsController < ApplicationController
def index
@climbings = Climbing.with_user
end
def new
@climbing = Climbing.new
respond_to do |format|
format.html # new.html.erb
function writeCode(callback) {
console.log("writeCode");
callback();
}
function introduceBugs() {
console.log("introduceBugs");
return function () {
console.log("callback")
}
}