Skip to content

Instantly share code, notes, and snippets.

View ykhs's full-sized avatar

Yukihisa Yamada ykhs

  • Autify, Inc.
  • Tokyo, Japan
View GitHub Profile
@ykhs
ykhs / chapter4_list3.js
Last active August 29, 2015 14:07
JavaScript養成読本 特集1 第4章 リスト3 訂正
var ContactView = Backbone.View.extend({
render: function() {
// HTMLテンプレートを取得する
var template = $('#contact-template').html();
// HTMLテンプレートにモデルのデータを適用する
// モデルのtoJSON()メソッドを使って属性を
// オブジェクトの形式で書き出す
var compiled = _.template(template)
var html = compiled(this.model.toJSON());
// 自身が保持しているDOM要素を更新する
@ykhs
ykhs / chapter4_listA.js
Created October 22, 2014 02:46
JavaScript養成読本 特集1 第4章 リストA 訂正
var ContactView = Backbone.View.extend({
template: '<div>Name: <%= firstName %> <%= lastName %></div>' +
'<div>Email: <%= email %></div>',
render: function() {
var compiled = _.template(this.template);
var html = compiled(this.model.toJSON());
this.$el.html(html);
return this;
}
@ykhs
ykhs / chapter4_list13.js
Created October 22, 2014 02:54
JavaScript養成読本 特集1 第4章 リスト13 訂正
var Todo = Backbone.Model.extend({
defaults: {
title: '',
completed: false
}
});
var TodoView = Backbone.View.extend({
template: '<label>' +
' <input class="toggle" type="checkbox">' +
@ykhs
ykhs / chapter7_list1.js
Created October 22, 2014 03:06
JavaScript養成読本 特集1 第7章 リスト1 訂正
App.NoteListItemView = Backbone.View.extend({
tagName: 'tr',
initialize: function() {
// モデルのdestroyイベントを監視して
// Backbone.Viewのremove()メソッドを呼び出す
this.listenTo(this.model, 'destroy', this.remove);
},
// [Delete]ボタンを監視して
// onClickDelete()メソッドを呼び出す
events: {
@ykhs
ykhs / chapter7_list5.js
Created October 22, 2014 03:09
JavaScript養成読本 特集1 第7章 リスト5 訂正
// js/note_detail.js
App.NoteDetailView = Backbone.View.extend({
render: function() {
var template = $('#noteDetailView-template').html();
var compiled = _.template(template);
var html = compiled(this.model.toJSON());
this.$el.html(html);
return this;
}
--- a/autoload/zencoding.vim
+++ b/autoload/zencoding.vim
@@ -456,7 +456,11 @@ function! s:zen_toString_html(settings, current, type, inline, filters, itemno,
else
if inline == 0
if stridx(','.settings.html.empty_elements.',', ','.current.name.',') != -1
- let str .= " />\n"
+ if &ft != 'xhtml'
+ let str .= ">\n"
+ else
@ykhs
ykhs / site.css
Created April 10, 2011 14:23
個人サイトに Sass を導入してみた(CSS 生成後)
/*!
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.3.0
build: 3167
*/
html {
color: #000;
background: #FFF; }
@ykhs
ykhs / _clearfix.scss
Created April 10, 2011 14:22
個人サイトに Sass を導入してみた
@mixin clearfix {
clear: both;
zoom: 1;
&:after {
content: ".";
display: block;
height: 0;
clear: both;
@ykhs
ykhs / _grid.scss
Created April 18, 2011 15:01
960 Grid System Using Sass.
/*!
Variable Grid System.
Learn more ~ http://www.spry-soft.com/grids/
Based on 960 Grid System - http://960.gs/
Licensed under GPL and MIT.
*/
// Containers
//----------------------------------------------------------------------------------------------------
@ykhs
ykhs / rebaseall.bat
Created April 21, 2011 06:55
Cygwin + git-svn で良く出てくる fatal error の対処
cd /d C:\cygwin\bin
ash rebaseall -v
pause