Skip to content

Instantly share code, notes, and snippets.

@hideki-a
hideki-a / config.js
Created August 3, 2011 05:45
CKEditor for Movable Type向けの設定ファイル
CKEDITOR.editorConfig = function (config) {
// 実体参照に変換する文字
config.entities_additional = '#9312,#9313,#9314,#9315,#9316,#9317,#9318,' +
'#9319,#9320,#9321,#9322,#9323,#9324,#9325,' +
'#9326,#9327,#9328,#9329,#9330,#9331';
// MTタグのエンティティ化を抑止
config.protectedSource.push(/<[\$\/]?mt[\s\S]*?>\n?/g);
// href,srcを相対パス化
@hideki-a
hideki-a / gist:2388223
Created April 14, 2012 22:32
Bookmarklet Sample 1
javascript:(function(){var a=document.querySelectorAll("#foo .bar"),b,c=a.length,d;for(b=0;b<c;b+=1){d=a[b];d.style.border="3px solid red";}}());
@hideki-a
hideki-a / sample.js
Created May 2, 2012 06:21
Dynamic style element
// See Also: http://www.phpied.com/dynamic-script-and-style-elements-in-ie/
// http://code.skyward-design.net/js/code_19.html
var head = document.getElementsByTagName("head")[0],
style = document.createElement("style"),
def = "body { color: red; }";
head.appendChild(style);
if (typeof window.attachEvent === "object" && style.styleSheet) {
// Less than IE9
style.styleSheet.cssText = def;
@hideki-a
hideki-a / grunt.js
Last active December 9, 2015 23:19
The grunt.js sample in the case of using grunt-styleguide.
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
compass: {
dev: {
reference: {
'htdocs/common/css': 'htdocs/_scss'
},
options: {
@hideki-a
hideki-a / run.coffee
Created December 29, 2012 13:15
run.js by coffeescript
# MJL
MJL.event.add window, "load", ->
MJL.enable.heightEqualizer "equalize-col2"
groupBy: 2
collect: (parent) ->
MJL.getElementsByClassName parent, "content"
MJL.enable.rollover "roll",
disable: "unroll"
return;
@hideki-a
hideki-a / Gruntfile.coffee
Last active December 14, 2015 15:09
Original gruntfile for generator-website.
'use strict'
PROJECT_DIR = ''
LIVERELOAD_PORT = 35729
lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT })
proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest
mountFolder = (connect, dir) ->
return connect.static(require('path').resolve(dir))
module.exports = (grunt) ->
grunt.initConfig
var movePCSiteBtn = document.querySelector(".btn-pcsite a");
function movePCSite(e) {
var xhr = new XMLHttpRequest(),
url = location.href,
pcUrl = url.replace("/sp/", "/");
e.preventDefault();
xhr.open("HEAD", pcUrl, true);
xhr.send();
xhr.onreadystatechange = function () {
if (xhr.status === 200) {
@hideki-a
hideki-a / labelChecker.js
Last active December 27, 2015 16:19
label要素と対応するコントロールを表示させる試み。使い方は次のURLを参照:https://github.com/bgrins/devtools-snippets
// labelchecker.js
// Forked from formcontrols.js
// https://github.com/bgrins/devtools-snippets
// Print out label and their controls
(function() {
var forms = document.querySelectorAll("form");
for (var i = 0, len = forms.length; i < len; i++) {
@hideki-a
hideki-a / unzip.php
Created December 6, 2013 01:37
共用サーバー上で、MTやa-blog cms等のCMSのzipファイルを解凍するツール。CMSのzipと共にアップし、このPHPにアクセスすればOK。
<?php
/*
* Unzip Tool
* Unzip files on shared server.
*
* The MIT License (MIT)
*
* Copyright (c) 2013 Hideki Abe
*/
@hideki-a
hideki-a / courseMap.js
Last active December 31, 2015 05:29
観光コース毎にGoogleマップを表示するもの。JSONには、観光スポットの緯度・経度が含まれている。
(function ($) {
function CourseMap(elem, options) {
this.elem = elem;
this.map = null;
this.markers = [];
this.defaults = {
zoom: 16,
strokeColor: "#cc0000",
strokeOpacity: 1.0,
strokeWeight: 2