Skip to content

Instantly share code, notes, and snippets.

View ww24's full-sized avatar
🏢
≡GO

Takenori Nakagawa ww24

🏢
≡GO
View GitHub Profile
@ww24
ww24 / README.md
Last active August 29, 2015 14:19
Service Workers Push API Hands-on

Service Workers Push API Hands-on

発表資料

manifest.json

gcm_sender_id は適切な値に書き換える。

localhost でテストする限りに於いては変更する必要なし。

@ww24
ww24 / minfix.sh
Last active October 24, 2016 01:53
ImageMagick を利用して、長方形の画像を一辺の長さを長辺に合わせた正方形に変換するシェルスクリプト
#!/bin/sh
if [ -z $1 ]; then
echo 'usage: minfix.sh image_path'
exit 1
fi
image_path=$1
min_width=511
min_height=375
@ww24
ww24 / short01.js
Last active August 29, 2015 14:18
Application Developer Festival 2015. Short coding. JavaScript部門 2 位. AtCoder System:JavaScript (Node.js 0.6.12)
/**
問題
入力: なし
出力:
高橋一郎
高橋二郎
高橋三郎
高橋四郎
高橋五郎
高橋六郎
@ww24
ww24 / example.com.conf
Last active August 29, 2015 14:17
Mac で開発用 HTTPS サーバ構築 ref: http://qiita.com/ww24/items/423108ac3659e0f06bc7
upstream backend {
server unix:/tmp/backend.sock;
}
server {
listen 4433 ssl;
server_name _;
# SSL
ssl_certificate /usr/local/etc/openssl/certs/cert.pem;
@ww24
ww24 / mac.md
Last active March 16, 2017 10:59
Windows を窓から投げ捨てて毒林檎を齧ってしまった人にお勧めのツールとアプリケーション一覧

準備

Xcode をインストール。

その後、 Terminal.app から以下の 1 行を実行して Command Line Tools をインストールする。

xcode-select --install

Finder の設定

@ww24
ww24 / .htaccess
Created December 8, 2014 18:01
redirect naked domain
# BEGIN Redirect naked domain
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(example\.com|example\.org)$
RewriteRule .* http://www.example.com/$0 [QSA,R=301,L]
</IfModule>
# END Redirect naked domain
@ww24
ww24 / fib.rb
Last active August 29, 2015 14:02
フィボナッチ数列 (Ruby の勉強)
fibonacci = Enumerator.new do |y|
i = [0, 1]
loop do
y << i[0]
i = [i[1], i[0] + i[1]]
end
end
# 遅延評価
p fibonacci.lazy.map{|x| x ** 2}.take(20).force
@ww24
ww24 / ca.js
Last active August 29, 2015 14:02
Life Game
/**
* Life Game - Cellular Automaton
*
* Author: Takenori Nakagawa
* License: GPLv3
*/
// cell constructor
function Cell(x, y, init) {
var value;
@ww24
ww24 / oop.js
Created June 6, 2014 09:06
JavaScript のオブジェクト指向
function F(message) {
this.message = message;
}
F.prototype.print = function () {
console.log(this.message);
};
// F を継承した G
function G(message, name) {
F.call(this, message);
@ww24
ww24 / index.html
Last active August 29, 2015 14:02
Global 名前空間のどの変数名をライブラリに使わせるか、利用者が選べるようにする仕組み。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>mylib</title>
</head>
<body>
<script src="mylib.js" data-mylib="lib"></script>
<script>
addEventListener("load", function () {