Skip to content

Instantly share code, notes, and snippets.

@hail2u
hail2u / installed-app.md
Last active April 27, 2017 07:48
2017-04-27現在、インストールしているアプリ

ランチャー

  • メール
  • Tweetbot
  • Instagram
  • Safari

ホーム画面

  • カレンダー
@hail2u
hail2u / reldate.js
Last active August 7, 2017 23:43
datetime属性を持つtime要素を全部相対時刻にするやつ
/*!
* reldate.js
*
* LICENSE: http://hail2u.mit-license.org/2016
*/
"use strict";
(function () {
const now = Date.now();
const toRelativeDate = function (then) {
@hail2u
hail2u / wrapfix.js
Created September 16, 2016 16:15
`h1`要素で一文字だけ次の行に行ってしまうのを防ぐ汎用スクリプト
/*!
* wrapfix.js
*
* LICENSE: http://hail2u.mit-license.org/2016
*/
"use strict";
(function (d) {
var e;
var h;
@hail2u
hail2u / sassc.vim
Created May 17, 2016 08:20
~/vimfiles/compiler/sassc.vim
if exists("current_compiler")
finish
endif
let current_compiler = "sass_scss"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
@hail2u
hail2u / gitrebase.vim
Created May 12, 2016 14:45
~/vimfiles/ftplugin/gitrebase.vim
function! s:CycleRebaseModes(num)
if type(a:num) != type(0)
return
endif
let modes = ['pick', 'reword', 'edit', 'squash', 'fixup', 'exec', 'drop']
let i = index(modes, expand('<cword>'))
if (i == -1)
if (a:num > 0)
@hail2u
hail2u / recursive-marked.js
Last active April 15, 2016 10:14
<section>...</section>とか書いてもその中もMarkdownとして処理するやつ
#!/usr/bin/env node
"use strict";
var marked = require("marked");
var md = `# Main Section
This is a paragraph.
@hail2u
hail2u / hmo.js
Created April 5, 2016 05:55
HTML Minifierのオプション
var optionsHTMLMinifier = {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyElements: true,
removeOptionalTags: true,
@hail2u
hail2u / flets-vs-docomo.md
Last active February 28, 2016 10:35
今契約しているフレッツ光とドコモ光、ドコモ光パックの比較
プラン 内訳 料金
フレッツ光 基本料金 5200
プロバイダ 1200
にねん割 -700
ポイント -400
5300
ドコモ光 基本料金 5200

|プラン |内訳 |料金 |

@hail2u
hail2u / ellipsis-title.js
Last active August 7, 2017 23:46
`text-overflow: ellipsis`が指定されている要素の`title`属性へテキストを仕込む汎用スクリプト
/*!
* ellipsis-title.js
*
* LICENSE: http://hail2u.mit-license.org/2016
*/
"use strict";
(function () {
var e;
var i;
@hail2u
hail2u / color-brightness.js
Created October 21, 2015 11:37
rgb()を渡すと0から255で明度を返す関数
function colorBrightness (color) {
var [c, r, g, b] = color.match(/rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/);
var brightness = ((r * 299) + (g * 587) + (b * 114)) / 1000;
return brightness;
}