Skip to content

Instantly share code, notes, and snippets.

@nowri
nowri / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nowri
nowri / gist:e7531d8be04070e3e916
Last active August 29, 2015 14:22
Gitコミットメッセージ
Fix:バグ修正
Add:新規(ファイル)機能追加
Modify:機能修正(バグではない)
Remove:削除(ファイル)
Update:更新
ex.
Modify トップページバナー差し替え
@nowri
nowri / gist:c81238ad8dec7133e8bb
Created April 7, 2015 12:40
gitのグラフをグラフィカルに
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.lga "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.graph "log --graph --date-order --all --pretty=format:'%h %Cred%d %Cgreen%ad %Cblue%cn %Creset%s' --date=short"
@nowri
nowri / RAFTimerUtil.js
Created March 16, 2015 11:18
requestAnimationFrame対応タイマー
/* global define */
define({
init:function(func, args){
window.requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
@nowri
nowri / Gruntfile.js
Created March 12, 2015 08:46
grunt-jadeでjade名と同名のjsonファイルを読み込む関数
function jadeDataFunc(env){
return function(dest, srcAr){ //dest が生成するhtml、srcが参照元jadeファイル
var _ = grunt.util._,
regDest = /\/([A-Za-z_0-9-]+?)\.html/,
destName = dest.match(regDest)[1],
dataPath = "src/jade/json/" + destName + ".json",
mergeData,
data;
try {
@nowri
nowri / Gruntfile.js
Last active August 29, 2015 14:10
grunt-contrib-jadeでjade名と同名のjsonファイルがあったら自動で読み込む
function jadeDataFunc(env) {
return function(dest, srcAr) { //dest が生成するhtml、srcが参照元jadeファイル
var _ = grunt.util._,
regDest = /\/([A-Za-z_0-9-]+?)\.html/,
destName = dest.match(regDest)[1],
dataPath = "src/jade/json/" + destName + ".json",
mergeData = _.clone(grunt.file.readJSON("src/jade/json/_common.json")),
data;
@nowri
nowri / font.css
Last active August 29, 2015 14:07
.sans-serif {
font-family: Verdana, "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", Meiryo, "メイリオ", sans-serif;
}
.serif {
font-family: font-family: "Times New Roman", "游明朝", YuMincho, "ヒラギノ明朝 ProN W3", "Hiragino Mincho ProN", "メイリオ", Meiryo, serif;
}
@nowri
nowri / stopMouseWheel.js
Last active August 29, 2015 14:04
マウスホイールを無効にするスニペット、レガシーブラウザ対応
/*global $, Modernizr */
/*
* @require jquery.mousewheel.js
*/
function stopMouseWheel(enabled){
if(Modernizr.touch){
return;
}
if(enabled) {
var wheel = function(event) {
// img elems
if(typeof window.addEventListener == 'undefined' && typeof document.getElementsByClassName == 'undefined') {
$('img').each(function() {
var $this = $(this),
src = $this.attr('src');
if(src.indexOf('.png') != -1) {
$this.css({
'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="scale");'
});
}
@nowri
nowri / posfixed.js
Created May 9, 2014 07:23
body min-width以下になった時に、position:fixed;width:100%;のコンテナの表示に対応させる
function runPosFixed(){
$(".js-pos-fixed").css("left", - Math.floor($(window).scrollLeft()) + "px");
}
$win.on("load scroll resize", function () {
runPosFixed();
});