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
@mixin all-retina-sprites($map, $dimensions: false){ | |
$base-class: sprite-map-name($map); | |
.#{$base-class}-retina-sprite{ | |
background: sprite-url($map) no-repeat; | |
@include background-size(ceil(image-width(sprite-path($map)) / 2) auto); | |
} | |
@each $sprite in sprite-names($map){ | |
.#{$base-class}-#{$sprite}{ |
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
on_sprite_saved do |filename| | |
if File.exists?(filename) | |
FileUtils.cp filename, filename.gsub(%r{-s[a-z0-9]{10}\.png$}, '.png') | |
end | |
end | |
on_stylesheet_saved do |filename| | |
if File.exists?(filename) | |
css = File.read filename | |
File.open(filename, 'w+') do |f| |
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
module.exports = function(grunt){ | |
'use strict'; | |
var path = require('path'); | |
var pkg = grunt.file.readJSON('package.json'); | |
grunt.initConfig({ | |
pkg: pkg, |
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
/* | |
* jquery.wait.js | |
* - 遅延を挟むユーティリティメソッド | |
* - jQuery 1.5 以上が必要 | |
*/ | |
;(function(window, $, undefined) { | |
$(function() { | |
// $.waitメソッドに遅延時間(ミリ秒)を設定する | |
$.wait(3000).done(function() { |
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(window, undefined) { | |
var checkKey = '__WEB_STORAGE_CHECK__'; | |
var isSupported = function(localOrSession) { | |
var _storage = window[localOrSession]; | |
return _storage ? (function() { | |
try { | |
_storage.setItem(checkKey, 1); | |
_storage.getItem(checkKey); | |
_storage.removeItem(checkKey); |
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
# 目次 | |
+ JavaScript オブジェクトと値の型 |
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
/* | |
* jquery.reduce.js | |
* - 実行回数を間引くユーティリティ | |
* - jQuery は名前空間を借りているだけ | |
*/ | |
;(function (window, $, undefined) { | |
$.extend({ | |
throttle: function(func, delay) { | |
var context = null; | |
var args = []; |
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
/* | |
* _.parseUrlQuery.js | |
* - Urlクエリーを解析してlocationオブジェクトを拡張する | |
* - Underscore.js が必要 | |
*/ | |
;(function(window, undefined) { | |
location.query = {}; | |
var queryString = location.search.substring(1); | |
if (queryString.length > 0) { |
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(window, $) { | |
// DOM Ready | |
$(function() { | |
$('.js-scroll').on('click', null, function(ev) { | |
ev.preventDefault(); | |
var $target = $(this.hash); | |
if ($target.length > 0) { | |
$('html, body').animate({ | |
scrollTop: $target.offset().top | |
}, 400); |
OlderNewer