Skip to content

Instantly share code, notes, and snippets.

View mitsuruog's full-sized avatar
🏄‍♂️
Surfing

Mitsuru Ogawa mitsuruog

🏄‍♂️
Surfing
View GitHub Profile
@mitsuruog
mitsuruog / app.js
Created June 16, 2013 14:05 — forked from pxsta/app.js
"use strict";
var express = require('express')
, http = require('http')
, path = require('path')
, io = require('socket.io')
, connect = require("express/node_modules/connect")
, Session = express.session.Session
, app = express();
//メモリストアかRedisのどちらかでセッションを保存
@mitsuruog
mitsuruog / main.js
Created May 17, 2013 03:34
jquery-patterns / window-scroll-event
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script>
/* Title: window scroll event
* Description: avoid attaching handlers to the window scroll event
@mitsuruog
mitsuruog / main.js
Last active December 16, 2015 16:59
JSPでUnderscore.jsのtemplate()を使う
/**
* _.templateSettingsにてテンプレートの区切り文字を変更してます。
* デフォルトは<%%>なので、Mustache.jsのような{{}}に変えてます。
*/
_.templateSettings = {
interpolate : /\{\{(.+?)\}\}/g
};
var tmpl = _.template($('#tmpl_hoge').html());
@mitsuruog
mitsuruog / diff_0.9.2...HEAD_index.diff
Created April 1, 2013 16:10
Backbone.js diff 0.9.2...HEAD index.html した結果
diff --git a/index.html b/index.html
index 581e230..5b790e4 100644
--- a/index.html
+++ b/index.html
@@ -3,6 +3,8 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
+ <meta name="viewport" content="width=device-width">
+ <link rel="canonical" href="http://backbonejs.org" />
@mitsuruog
mitsuruog / Gruntfile.js
Last active December 14, 2015 10:59
Backbone with handlebar.js
module.exports = function(grunt) {
grunt.initConfig({
//some...
handlebars: {
compile: {
options: {
namespace: "MyApp.Templates",
@mitsuruog
mitsuruog / global.event.js
Last active December 14, 2015 06:09
jQueryイベントtips
jQuery.page = jQuery({}); //空のオブジェクト
//Usage
jQuery.page.bind('change', function(e, title){
jQuery('#text').text('Page is' + title);
});
jQuery.page.trigger('change', 'Inbox');
@mitsuruog
mitsuruog / after.onbeforeunload.js
Created February 26, 2013 09:34
onbeforeunloadのCallback
var timeout;
function warning() {
timeout = setTimeout(function() {
alert('You stayed');
}, 1000);
return "You are leaving the page";
}
function noTimeout() {
@mitsuruog
mitsuruog / child.html
Created February 26, 2013 06:27
子画面制御
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<title></title>
</head>
<body>
@mitsuruog
mitsuruog / submodule.sh
Created February 22, 2013 16:22
一度追加したgit submoduleを更新するスニペット
$ git submodule foreach 'git pull origin master'
//これをやると元に戻る...orz
$ git submodule update
@mitsuruog
mitsuruog / html5.html
Last active December 13, 2015 20:38
HTMLスニペット
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="ja" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="ja" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="ja" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="ja" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="ja" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />