Skip to content

Instantly share code, notes, and snippets.

import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
const repl = require('repl')
async function bootstrap () {
const app = await NestFactory.createApplicationContext(AppModule)
console.log('starting repl ...')
repl.start().context.app = app
}
.py-2 {
padding-top: 6px !important;
padding-bottom: 6px !important;
}
.BorderGrid--spacious .BorderGrid-cell {
padding-top: 16px;
padding-bottom: 16px;
}
#! /usr/bin/awk -f
BEGIN {
FS = "\t"
print "\n"
}
$9 ~ /heroku\/router/ {
split($10, c, " ")
path = c[3]
@wtnabe
wtnabe / test-prepare-and-clean.rake
Last active April 30, 2020 10:42
test:prepare task を利用し、テスト開始前に必要なプロセスを foreman で起動しつつ rake 終了時に掃除する ( Thread が at_exit で自動的に kill されることを利用している )
require 'childprocess'
if (!ENV['CI_ENV'] && ENV['CI_ENV'] != 'false')
namespace :test do
task :prepare do
puts 'foreman start -f Procfile.test'
Thread.new do
begin
ChildProcess.posix_spawn = true
puts "foreman starting ..."
@wtnabe
wtnabe / forceTimeout.js
Last active April 23, 2020 14:09
強制的にtimeout扱いで例外を上げるwrapper function
class ForceTimeout extends Error {
get name () { return 'ForceTimeout' }
}
async function forceTimeout (time, cb) {
const intervalId = setInterval(() => {
throw new ForceTimeout()
}, time)
try {
@wtnabe
wtnabe / function-runtimes.rb
Last active April 1, 2020 00:17
List up functions with filter
#! /usr/bin/env ruby
require 'json'
#
# [param] Proc filter
#
def main(&filter)
puts projects.select { |project|
functionEnabled?(services(project['projectId']))
@wtnabe
wtnabe / jquery-and-mobx-counter.html
Last active March 29, 2020 04:48
jQuery and MobX counter
<html>
<head>
<script crossorigin type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mobx/4.15.0/mobx.umd.min.js"></script>
<script crossorigin type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
<script type="text/javascript">
controller = {
$el: undefined,
init: function ($el) {
this.$el = $el
this.render()
@wtnabe
wtnabe / git-commit-spreader.rb
Created February 29, 2012 14:09
spread each git commits to branches
#! /usr/bin/env ruby
i = 1
`git log --reverse --oneline`.lines.map { |commit|
commit.chomp.split(/\s+/).first
}.each { |ref|
system(sprintf("git branch %02d_%s %s", i, ref, ref))
i += 1
}
const assert = require('assert')
class Klass {
// correct
methodWithCall (val, cb) {
this.val = val
return cb.call(this, val)
}
wtnabe : 写真の管理をGoogle Photos + Cloud Storageに移行した
wtnane : エディタでエディットしたい
shirokuro331: チームビルディングの話
shiget84: 引き継ぎの話
ryusei : ベトナムエンジニアと仲良く仕事をするには?
izawa: 2019買い物ベスト8
shirokuro331: 非エンジニアがプロダクトマネージャーになって1年経ちました
t11a:俺とさいごのKanazawa.rb
shiget84: 最近読んだ本の話
kentarom: Slackアプリ開発を通してTypeScriptの学習に挑戦してみた