Skip to content

Instantly share code, notes, and snippets.

View ukoasis's full-sized avatar

Yuki Yamashina ukoasis

View GitHub Profile
@ukoasis
ukoasis / gist:e7a9f18e5b28af77dda65977c1437bc2
Created August 15, 2018 02:50
2次元配列を左に90°回転させるサンプル
const assert = require('assert');
const arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
const answer = [[3, 6, 9], [2, 5, 8], [1, 4, 7]];
const wrongAnswer = [[4, 6, 9], [2, 5, 8], [1, 4, 7]];
const rotate = b => {
const transpose = a => a[0].map((_, c) => a.map(r => r[c]));
return transpose(b).reverse();
};
const { environment } = require('@rails/webpacker')
const babelLoader = environment.loaders.get('babel')
environment.loaders.insert('svg', {
test: /\.svg$/,
use: babelLoader.use.concat([
{
loader: 'react-svg-loader',
options: {
@ukoasis
ukoasis / file0.txt
Created February 2, 2017 09:46
Deviseでconfirmableの登録確認メールを受け取れない場合に登録を完了させる方法 ref: http://qiita.com/ukoasis/items/e8dc35e1be582be260ce
> User.find(1).send_confirmation_instructions.body
(0.2ms) BEGIN
(0.2ms) COMMIT
Rendering devise/mailer/confirmation_instructions.html.slim
Rendered devise/mailer/confirmation_instructions.html.slim (0.6ms)
Devise::Mailer#confirmation_instructions: processed outbound mail in 115.8ms
Sent mail to fooooo+test5@test.cdd (4.1ms)
Date: Thu, 02 Feb 2017 17:36:46 +0900
From: please-change-me-at-config-initializers-devise@example.com
Reply-To: please-change-me-at-config-initializers-devise@example.com
@ukoasis
ukoasis / file0.txt
Last active February 2, 2017 09:47
Rails5なAPIで単純に404を返す方法 ref: http://qiita.com/ukoasis/items/53cebcfb9b6c7ee9dbeb
head :not_found
@ukoasis
ukoasis / file0.txt
Created July 24, 2016 05:46
NeoVim + Elixirで開発環境を設定してみた ref: http://qiita.com/ukoasis/items/25fb834a806ad3695942
snippet pipe
abbr pipeline
options head
pipeline :${1:browser} do
${2}
end
snippet pipe
abbr pipe_through
options head
var fs = require('fs');
var exec = require('child_process').exec;
fs.readdir('.', (err, files) => {
if (err) throw err;
var fileList = [];
files.filter((file) => {
return fs.statSync(file).isFile() && /.*\.m4a$/.test(file)
}).forEach((file) => {
file = __dirname + "/" + file