Skip to content

Instantly share code, notes, and snippets.

View nukosuke's full-sized avatar
🍊
🐈 🐈 🐈

nukosuke nukosuke

🍊
🐈 🐈 🐈
View GitHub Profile
@nukosuke
nukosuke / kiritsubo.js
Created June 8, 2016 00:02
node.jsでKyokoさんに源氏物語1章を朗読してもらう
var client = require('cheerio-httpcli');
var execSync = require('child_process').execSync;
client.fetch('http://attic.neophilia.co.jp/aozora/genjimonogatari/htmlfiles/kiritsubo.html', {}, (err, $, res) => {
$('p').each(function(idx) {
$(this)[0].children
.filter(item => item.type === 'text')
.map(item => item.data.replace(/(.+)/g, ''))
.forEach(item => execSync(`say ${item}`));
});
npm install annict --save
@nukosuke
nukosuke / build_annictjs_document.sh
Created September 25, 2016 14:29
annict.jsのドキュメント生成&公開スクリプト
#!/bin/sh
npm install && \
npm run docs && \
git checkout gh-pages && \
rm -rf classes interfaces assets index.html && \
mv ./docs/* . && \
rmdir docs && \
git add . && \
git commit -m "build $(git describe --abbrev=0 master) document : $(date)" && \
@nukosuke
nukosuke / .travis.yml
Created October 11, 2016 07:19
PHP Travis CI config
language: php
php:
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- hhvm
@nukosuke
nukosuke / install-emacs.sh
Created October 12, 2016 21:48
Emacsインストール
#!/bin/sh
brew install --with-cocoa --srgb --with-gnutls emacs
brew linkapps emacs
@nukosuke
nukosuke / get-string-and-split-into-integer.ex
Last active October 20, 2016 03:30
ワンライナーでスペース区切りで表現された数列を標準入力から1行を読み込んで整数値に変換する方法
"" |> IO.gets |> String.trim_trailing |> String.split(" ") |> Enum.map(&String.to_integer(&1))
@nukosuke
nukosuke / Makefile
Created October 22, 2016 02:31
みんなのGo言語に載っているMakefileタスクのテンプレ
# メタ情報
NAME := myproj
VERSION := $(shell git describe --tags --abbrev=0)
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.version=$(VERSION)' \
-X 'main.revision=$(REVISION)'
# 必要なツール類をセットアップする
## Setup
setup:
@nukosuke
nukosuke / pyramid.js
Created October 29, 2016 16:59
co3496558でやってたピラミッド作る問題
function createPyramid(height){
return Array.from({length: height}, (v,k) => k+1)
.map(r => ' '.repeat(height-r).concat('*'.repeat(r*2-1)))
.join('\n');
}
console.log(createPyramid(10));
@nukosuke
nukosuke / server.js
Last active January 26, 2017 04:12
react on rails rendering server using Node.js
// client/node/server.js
// https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/node-server-rendering.md
var net = require('net');
var fs = require('fs');
var bundlePath = '../../app/assets/webpack/';
var bundleFileName = 'webpack-bundle.js';
var currentArg;
use IO::Socket::UNIX;
use JSON;
my $SOCK_PATH = "./node.sock";
print $SOCK_PATH;
my $client = IO::Socket::UNIX->new(
Type => SOCK_STREAM(),
Peer => $SOCK_PATH,
) or die $!;