Skip to content

Instantly share code, notes, and snippets.

@hail2u
hail2u / next-update.log
Created July 6, 2014 20:43
依存パッケージのバージョンを一時的に上げてテストが通るかチェックしてくれるnext-updateのログ。便利そう。
$ next-update --latest
next-update - Tests if module's dependencies can be updated to latest version
version: 0.4.5
author: {"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"}
checking if the current state works
npm test
current state works
module's current dependencies:
package available
-------- ---------
@hail2u
hail2u / transparent.png
Created July 11, 2014 10:58
サーモンピンクのチェック模様のPNG画像をData URIにしたもの
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAQHRrUGdUa1BORyAgQ29weVJpZ2h0IFRha2kgQWxsIFJpZ2h0IFJlc2VydmVkAI0AAA0AAABSREhJmDlXAOa9SQCQkWg2mDWMHgAAAB5JREFUKM9j+H9jL3aEAzCMaqCNBlwAh0GjGmiiAQBn/cifTDaT1wAAAABJRU5ErkJggg==
@hail2u
hail2u / package.json
Created July 12, 2014 01:05
npm run-scriptsで生きていくの辛そう。
{
"name": "picks.hail2u.net",
"private": true,
"scripts": {
"build": "node index.js",
"postbuild": "git commit --all --message=\"Rebuild\"",
"preupdate": "git checkout gh-pages",
"update": "git checkout master -- \"*\" && git reset && git add index.html */index.html && git clean -f",
"postupdate": "git commit --all --message=\"Rebuild\"",
"deploy": "npm run build && npm run update && git push origin gh-pages",
@hail2u
hail2u / htmlhint
Last active August 29, 2015 14:04
VimでHTMLHintする奴
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var htmlhint = require('htmlhint').HTMLHint;
var path = require('path');
var ruleset = {
'tagname-lowercase': true,
@hail2u
hail2u / blog.html
Last active August 29, 2015 14:04 — forked from azu/blog.html
<!-- start -->
<section>
<header>
<h1 class="jser-sitelink">strict mode - motivation and semantics - Constellation Scorpius</h1>
<p><a title="strict mode - motivation and semantics - Constellation Scorpius" href="http://utatane-constellation.tumblr.com/post/3711268645" target="_blank">http://utatane-constellation.tumblr.com/post/3711268645</a></p>
</header>
<p>strict modeの概念とは何か<br/> static解析につながる話</p>
</section>
<!-- end -->
<pre><samp>$ <kbd>git --version</kbd>
<samp>
Usage: npm <command>
...
npm@1.4.10 c:\nodejs\node_modules\npm</samp></pre>
@hail2u
hail2u / sass.js.patch
Created August 6, 2014 23:45
Support new `--sourcemap=[auto|file|inline|none]` as well as old `--sourcemap` option
diff --git tasks/sass.js tasks/sass.js
index 96ac499..85db65c 100644
--- tasks/sass.js
+++ tasks/sass.js
@@ -29,6 +29,7 @@ module.exports = function (grunt) {
var passedArgs;
var bundleExec;
var banner;
+ var sourcemap;
@hail2u
hail2u / datauri
Created August 7, 2014 12:53
カーソル下のパスをData URIに変換するVimスクリプト。通常はbase64だが、SVGだけSVGOを使ってURLエンコードする。
#!/usr/bin/env node
var fs = require('fs');
var mime = require('mime');
var file = process.argv.slice(2)[0];
fs.readFile(file, function (error, data) {
if (error) {
throw error;
@hail2u
hail2u / test.compact.css
Created August 17, 2014 06:16
&を使ったネストで、nestedとexpandedで出力されるCSSの改行位置が気持ち悪い
.foo, .bar, .baz { display: auto; }
.qux .foo:before, .qux .bar:before, .qux .baz:before { content: "test"; }
@hail2u
hail2u / expand-env.js
Created August 17, 2014 10:37
環境変数入りのパスを展開するののだいたい動くやつ
function expandPath(p) {
return p.replace(/(?:\$(\w+?)|%(.*?)%)/g, function (match, name) {
return process.env[name];
});
}
console.log(expandPath('$HOME/foo/bar')); // C:/Users/John/foo/bar
console.log(expandPath('%USERPROFILE%\\foo\\bar')); // C:\\Users\\John\\foo\\bar