Skip to content

Instantly share code, notes, and snippets.

@bathtimefish
bathtimefish / kotoura-san-bookmarklet
Created November 12, 2012 16:37
琴浦さん応援バナーを表示するブックマークレット
javascript:(function(){for(var a=document.createElement("div"),b=document.createElement("a"),c=document.createElement("img"),d=["Webkit","Moz","O","ms","Khtml"],e="animation",f="aD",g="aT",h="aI",i="",j="",k=0;k<d.length;k++)if(void 0!==a.style[d[k]+"Animation"]){j=d[k];e=j+"AnimationName";f=j+"AnimationDuration";g=j+"AnimationTimingFunction";h=j+"AnimationIterationCount";i="-"+j.toLowerCase()+"-";break}for(k=0;k<d.length;k++)if(void 0!==a.style[d[k]+"Transform"]){j=d[k];break}
var l="@"+i+"keyframes rotate { 0% {"+i+"transform:rotateY( 0deg );}90% {"+i+"transform:rotateY( 0deg);}95% {"+i+"transform:rotateY( 360deg);}100% {"+i+"transform:rotateY( 0deg);}}";a.style[e]="rotate";a.style[f]="5s";a.style[g]="linear";a.style[h]="infinite";var m=document.createElement("style");m.innerHTML=l;document.getElementsByTagName("head")[0].appendChild(m);a.style.position="absolute";a.style.padding="1px";a.style.zIndex="500";b.href="http://kotourasan.net/s/oen.html";
c.src="http://kotourasan.net/images/banner/350_240.jpg";var
@bathtimefish
bathtimefish / node-access-limitter.coffee
Last active December 11, 2015 00:29
node.js http serverで複数のremoteHost, requestMethodを判定してアクセス制御をする
http = require 'http'
allows =
"127.0.0.1" : ['POST','PUT']
"192.168.0.10" : ['GET','POST','PUT','DELETE']
httpServer = http.createServer (req, res)->
allowed = false
for ip, methods of allows
if ip == req.connection.remoteAddress
@bathtimefish
bathtimefish / Gruntfile.js
Created January 15, 2013 10:12
Yeomanでクラスごとに分割したCoffeeScriptファイルを結合してからコンパイルするよう設定したGruntfile.js watchブロックで.coffeeをconcatしてall.coffeeを生成、all.coffeeをall.jsにコンパイルする。このサンプルではJubiolのソースコードをコンパイルできるよう設定してある。 https://github.com/giginet/Jubiol
module.exports = function( grunt ) {
'use strict';
//
// Grunt configuration:
//
// https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
//
grunt.initConfig({
// Project configuration
@bathtimefish
bathtimefish / show-webstrage-bookmarklet.js
Created February 10, 2013 02:39
WebStorageに保存されているの一覧を表示するブックマークレット
javascript:(function(){a=['[sessionStorage]'];for(k%20in%20sessionStorage)a.push(k+"%20:%20"+sessionStorage.getItem(k));a.push('[localStorage]');for(k%20in%20localStorage)a.push(k+"%20:%20"+localStorage.getItem(k));alert(a.join("\n"));})()
@bathtimefish
bathtimefish / Gruntfile.js
Last active December 14, 2015 09:59
yeoman anguler を coffeeにしてみた
module.exports = function( grunt ) {
'use strict';
//
// Grunt configuration:
//
// https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
//
grunt.initConfig({
// Project configuration
@bathtimefish
bathtimefish / part-of-index.css
Created March 16, 2013 13:22
CSSで仕切り線みたいのを書いていたらIE10でスクロール毎に大きさが変わるようになった。バグ? index.html で表示がおかしくなる。 index2.html だと大丈夫。
div.index1 {
height: 34px;
border-bottom: solid 7px green;
margin-bottom: 20px;
clear:both;
}
div.index1 > span.title {
width: 100px;
padding: 6px 30px 1px 10px;
@bathtimefish
bathtimefish / app.coffee
Last active December 16, 2015 10:39
Yeoman開発用 APIプロキシ。YeomanでREST APIサーバーとフロントエンドを同時に開発する際に使用する。 node-http-proxyのインストールが必要 'npm install http-proxy'
define(['jquery'], ($)->
'use strict'
$.getJSON('api/items/', (data)->
ul = document.querySelector('div.hero-unit > ul')
for row in data
li = document.createElement 'li'
txt = document.createTextNode "#{row.id}, #{row.user}, #{row.message}"
li.appendChild txt
ul.appendChild li
)
@bathtimefish
bathtimefish / gas-raw-hilighter.js
Created June 7, 2013 04:11
Google Apps Script スプレッドシートで特定の列セルに入力した文字に応じて対応する行の背景色を変更する。 TODOシートなどで「完了」を入力したらその行を自動的に完了の色にする。という感じで使う
/*
The MIT License (MIT)
Copyright (C) 2013, Masakazu Muraoka <muraoka@bathtimefish.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@bathtimefish
bathtimefish / glassware-html-example
Last active December 18, 2015 04:49
Glassware用の実験のアレ
# うまくいった
<article>
<figure>
<img src="https://si0.twimg.com/profile_images/53494994/btf_logo.jpg" alt="example1 image">
</figure>
<section>
<h1>Example1. Hello</h1>
<p class="text-x-small">
<img src="https://mirror-api-playground.appspot.com/links/rated_r.png" alt="">
x-small text
@bathtimefish
bathtimefish / selection-pickup.html
Last active December 18, 2015 16:29
カーソル選択時に選択文字列をピックアップする
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>カーソル選択時に選択文字列をピックアップする</title>
</head>
<body>
<h1>The MIT License</h1>
<p>以下に定める条件に従い、本ソフトウェアおよび関連文書のファイル(以下「ソフトウェア」)の複製を取得するすべての人に対し、ソフトウェアを無制限に扱うことを無償で許可します。これには、ソフトウェアの複製を使用、複写、変更、結合、掲載、頒布、サブライセンス、および/または販売する権利、およびソフトウェアを提供する相手に同じことを許可する権利も無制限に含まれます。</p>
<p>上記の著作権表示および本許諾表示を、ソフトウェアのすべての複製または重要な部分に記載するものとします。</p>