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 / gist:3027432
Created July 1, 2012 07:53
Shadow DOM Sample
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
<!-- このスタイルは文書ツリー側に定義したものなので Shadow DOM 内部には適用されない。 -->
<style>
section.articleBox h1 {
color: black;
}
@ykhs
ykhs / gist:2949050
Created June 18, 2012 15:53
100数える
Array.apply(null, Array(100)).forEach(function(x, i) {
console.log(i + 1);
});
@ykhs
ykhs / flattenHeights.js
Created May 23, 2012 02:54
要素の高さ揃えたい
function flattenHeight(elements) {
var maxHeight, i, l, defaultView;
maxHeight = 0;
i = 0;
l = elements.length;
defaultView = document.defaultView || {};
if (defaultView.getComputedStyle) {
var collection = Backbone.Collection.extend({
originalSync: Backbone.sync,
sync: function(method, model, options) {
var originalSuccess, cache;
if (method !== 'read') {
this.originalSync(method, model, options);
@ykhs
ykhs / gist:1048792
Created June 27, 2011 12:49
オレオレ addEvent
function addEvent(element, type, handler, data, context) {
if (!element) { return false; }
if (!handler) { return false; }
context = context || element;
var fn = function (e) {
e = e || win.event;
(function ($) {
$(function () {
// jQuery の要素集合をキャッシュ
var $slider_root = $('#slider'),
$slider_ul = $slider_root.find('ul'),
$slider_li = $slider_ul.find('li'),
sliderWidth = $slider_li.outerWidth(true) * $slider_li.size(),
viewWidth = 800;
@ykhs
ykhs / rebaseall.bat
Created April 21, 2011 06:55
Cygwin + git-svn で良く出てくる fatal error の対処
cd /d C:\cygwin\bin
ash rebaseall -v
pause
@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 / _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 / 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; }